mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Create Discord users table
This commit is contained in:
parent
23b965410b
commit
d3ee249bc9
2 changed files with 30 additions and 1 deletions
|
@ -5,5 +5,6 @@ from .aliases import Alias
|
|||
from .activekvgroup import ActiveKvGroup
|
||||
from .keyvalue import Keyvalue
|
||||
from .keygroup import Keygroup
|
||||
from .discord import Discord
|
||||
|
||||
__all__ = ["Royal", "Telegram", "Diario", "Alias", "ActiveKvGroup", "Keyvalue", "Keygroup"]
|
||||
__all__ = ["Royal", "Telegram", "Diario", "Alias", "ActiveKvGroup", "Keyvalue", "Keygroup", "Discord"]
|
||||
|
|
28
royalnet/database/tables/discord.py
Normal file
28
royalnet/database/tables/discord.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
from sqlalchemy import Column, \
|
||||
Integer, \
|
||||
String, \
|
||||
BigInteger, \
|
||||
ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
from .royals import Royal
|
||||
|
||||
|
||||
class Discord:
|
||||
__tablename__ = "discord"
|
||||
|
||||
royal_id = Column(Integer, ForeignKey("royals.uid"))
|
||||
discord_id = Column(BigInteger, primary_key=True)
|
||||
username = Column(String)
|
||||
discriminator = Column(String)
|
||||
avatar_hash = Column(String)
|
||||
|
||||
royal = relationship("Royal", backref="telegram")
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Discord {str(self)}>"
|
||||
|
||||
def __str__(self):
|
||||
return f"[c]discord:{self.full_username()}[/c]"
|
||||
|
||||
def full_username(self):
|
||||
return f"{self.username}#{self.discriminator}"
|
Loading…
Reference in a new issue