class GuildMembers(Base): __tablename__ = "guild_members" id = db.Column(db.Integer, primary_key=True) # Auto incremented id guild_id = db.Column(db.BigInteger) # Discord guild id user_id = db.Column(db.BigInteger) # Discord user id username = db.Column(db.String(255)) # Name discriminator = db.Column(db.Integer) # User discriminator nickname = db.Column(db.String(255)) # User nickname avatar = db.Column(db.String(255)) # The avatar str of the user active = db.Column(db.Boolean()) # If the user is a member of the guild banned = db.Column(db.Boolean()) # If the user is banned in the guild roles = db.Column(db.Text()) # Member roles def __init__(self, guild_id, user_id, username, discriminator, nickname, avatar, active, banned, roles): self.guild_id = guild_id self.user_id = user_id self.username = username self.discriminator = discriminator self.nickname = nickname self.avatar = avatar self.active = active self.banned = banned self.roles = roles def __repr__(self): return '<GuildMembers {0} {1} {2} {3} {4}>'.format( self.id, self.guild_id, self.user_id, self.username, self.discriminator)
class Messages(Base): __tablename__ = "messages" message_id = db.Column(db.BigInteger, primary_key=True) # Message snowflake guild_id = db.Column(db.BigInteger) # Discord guild id channel_id = db.Column(db.BigInteger) # Channel id content = db.Column(db.Text()) # Message contents author = db.Column(db.Text()) # Author json timestamp = db.Column(db.TIMESTAMP) # Timestamp of when content is created edited_timestamp = db.Column( db.TIMESTAMP) # Timestamp of when content is edited mentions = db.Column(db.Text()) # Mentions serialized attachments = db.Column(db.Text()) # serialized attachments embeds = db.Column(db.Text().with_variant(db.Text(length=4294967295), 'mysql')) # message embeds def __init__(self, guild_id, channel_id, message_id, content, author, timestamp, edited_timestamp, mentions, attachments, embeds): self.guild_id = guild_id self.channel_id = channel_id self.message_id = message_id self.content = content self.author = author self.timestamp = timestamp self.edited_timestamp = edited_timestamp self.mentions = mentions self.attachments = attachments self.embeds = embeds def __repr__(self): return '<Messages {0} {1} {2} {3} {4}>'.format(self.id, self.guild_id, self.guild_id, self.channel_id, self.message_id)
class Cosmetics(db.Model): __tablename__ = "cosmetics" id = db.Column(db.Integer, primary_key=True) # Auto increment id user_id = db.Column(db.String(255), nullable=False) # Discord user id of user of cosmetics css = db.Column(db.Boolean(), nullable=False) # If they can create/edit custom CSS css_limit = db.Column(db.Integer, nullable=False, server_default="0") # Custom CSS Limit webhook_icon = db.Column( db.Boolean(), nullable=False, server_default=db.false( )) # If they can set the webhook icon for all guilds def __init__(self, user_id, **kwargs): self.user_id = user_id if "css" in kwargs: self.css = kwargs["css"] else: self.css = False if "css_limit" in kwargs: self.css_limit = kwargs["css_limit"] else: self.css_limit = 0 if "webhook_icon" in kwargs: self.webhook_icon = kwargs["webhook_icon"] else: self.webhook_icon = False
class Messages(Base): __tablename__ = "messages" id = db.Column(db.Integer, primary_key=True) # Auto incremented id guild_id = db.Column(db.String(255)) # Discord guild id channel_id = db.Column(db.String(255)) # Channel id message_id = db.Column(db.String(255)) # Message snowflake content = db.Column(db.Text()) # Message contents author = db.Column(db.Text()) # Author json timestamp = db.Column(db.TIMESTAMP) # Timestamp of when content is created edited_timestamp = db.Column( db.TIMESTAMP) # Timestamp of when content is edited mentions = db.Column(db.Text()) # Mentions serialized attachments = db.Column(db.Text()) # serialized attachments def __init__(self, guild_id, channel_id, message_id, content, author, timestamp, edited_timestamp, mentions, attachments): self.guild_id = guild_id self.channel_id = channel_id self.message_id = message_id self.content = content self.author = author self.timestamp = timestamp self.edited_timestamp = edited_timestamp self.mentions = mentions self.attachments = attachments def __repr__(self): return '<Messages {0} {1} {2} {3} {4}>'.format(self.id, self.guild_id, self.guild_id, self.channel_id, self.message_id)
class TitanTokens(db.Model): __tablename__ = "titan_tokens" user_id = db.Column(db.BigInteger, nullable=False, primary_key=True) # Discord user id of user tokens = db.Column(db.Integer, nullable=False, default=0) # Token amount def __init__(self, user_id, tokens): self.user_id = user_id self.tokens = tokens
class UnauthenticatedBans(Base): __tablename__ = "unauthenticated_bans" id = db.Column(db.Integer, primary_key=True) # Auto increment id guild_id = db.Column( db.String(255)) # Guild pretaining to the unauthenticated user ip_address = db.Column(db.String(255)) # The IP Address of the user last_username = db.Column( db.String(255)) # The username when they got banned last_discriminator = db.Column( db.Integer) # The discrim when they got banned timestamp = db.Column( db.TIMESTAMP) # The timestamp of when the user got banned reason = db.Column( db.Text()) # The reason of the ban set by the guild moderators lifter_id = db.Column( db.BigInteger) # Discord Client ID of the user who lifted the ban placer_id = db.Column(db.BigInteger) # The id of who placed the ban def __init__(self, guild_id, ip_address, last_username, last_discriminator, reason, placer_id): self.guild_id = guild_id self.ip_address = ip_address self.last_username = last_username self.last_discriminator = last_discriminator self.timestamp = datetime.datetime.fromtimestamp( time.time()).strftime('%Y-%m-%d %H:%M:%S') self.reason = reason self.lifter_id = None self.placer_id = placer_id def __repr__(self): return '<UnauthenticatedBans {0} {1} {2} {3} {4} {5}'.format( self.id, self.guild_id, self.ip_address, self.last_username, self.last_discriminator, self.timestamp)
class UserCSS(db.Model): __tablename__ = "user_css" id = db.Column(db.Integer, primary_key=True) # Auto increment id name = db.Column(db.String(255), nullable=False) # CSS Name user_id = db.Column(db.String(255), nullable=False) # Discord client ID of the owner of the css (can edit) css = db.Column(db.Text(4294967295)) # CSS contents def __init__(self, name, user_id, css=None): self.name = name self.user_id = user_id self.css = css
class AuthenticatedUsers(db.Model): __tablename__ = "authenticated_users" id = db.Column(db.Integer, primary_key=True) # Auto increment id guild_id = db.Column( db.BigInteger, nullable=False) # Guild pretaining to the authenticated user client_id = db.Column( db.BigInteger, nullable=False) # Client ID of the authenticated user def __init__(self, guild_id, client_id): self.guild_id = guild_id self.client_id = client_id
class GuildMembers(db.Model): __tablename__ = "guild_members" id = db.Column(db.Integer, primary_key=True) # Auto incremented id guild_id = db.Column(db.BigInteger) # Discord guild id user_id = db.Column(db.BigInteger) # Discord user id username = db.Column(db.String(255)) # Name discriminator = db.Column(db.Integer) # User discriminator nickname = db.Column(db.String(255)) # User nickname avatar = db.Column(db.String(255)) # The avatar str of the user active = db.Column(db.Boolean()) # If the user is a member of the guild banned = db.Column(db.Boolean()) # If the user is banned in the guild roles = db.Column(db.Text()) # Member roles
class Cosmetics(db.Model): __tablename__ = "cosmetics" id = db.Column(db.Integer, primary_key=True) # Auto increment id user_id = db.Column(db.String(255), nullable=False) # Discord user id of user of cosmetics css = db.Column(db.Boolean(), nullable=False) # If they can create/edit custom CSS def __init__(self, user_id, **kwargs): self.user_id = user_id if "css" in kwargs: self.css = kwargs["css"] else: self.css = False
class DiscordBotsOrgTransactions(db.Model): __tablename__ = "discordbotsorg_transactions" id = db.Column(db.Integer, primary_key=True) # Auto increment id user_id = db.Column(db.BigInteger, nullable=False) # Discord user id of user timestamp = db.Column(db.TIMESTAMP, nullable=False) # The timestamp of when the action took place action = db.Column(db.String(255), nullable=False) # Very short description of the action referrer = db.Column(db.BigInteger, nullable=True) # Discord user id of the referrer def __init__(self, user_id, action, referrer=None): self.user_id = user_id self.action = action if referrer: self.referrer = referrer self.timestamp = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S')
class KeyValueProperties(db.Model): __tablename__ = "keyvalue_properties" id = db.Column(db.Integer, primary_key=True) # Auto incremented id key = db.Column(db.String(255), nullable=False) # Property Key value = db.Column(db.Text()) # Property value expiration = db.Column(db.TIMESTAMP) # Suggested Expiration for value (None = no expire) in secs def __init__(self, key, value, expiration=None): self.key = key self.value = value if expiration: self.expiration = datetime.now() + timedelta(seconds = expiration) else: self.expiration = None
class Patreon(db.Model): __tablename__ = "patreon" user_id = db.Column(db.BigInteger, nullable=False, primary_key=True) # User ID from patreon total_synced = db.Column(db.Integer, nullable=False) # Total cents synced on our end def __init__(self, user_id, total_synced=0): self.user_id = user_id self.total_synced = total_synced def __repr__(self): return '<Patreon {0} {1} {2}>'.format(self.id, self.user_id, self.total_synced)
class Messages(db.Model): __tablename__ = "messages" message_id = db.Column(db.BigInteger, primary_key=True) # Message snowflake guild_id = db.Column(db.BigInteger) # Discord guild id channel_id = db.Column(db.BigInteger) # Channel id content = db.Column(db.Text()) # Message contents author = db.Column(db.Text()) # Author json timestamp = db.Column(db.TIMESTAMP) # Timestamp of when content is created edited_timestamp = db.Column( db.TIMESTAMP) # Timestamp of when content is edited mentions = db.Column(db.Text()) # Mentions serialized attachments = db.Column(db.Text()) # serialized attachments embeds = db.Column(db.Text().with_variant(db.Text(length=4294967295), 'mysql')) # message embeds
class UnauthenticatedUsers(db.Model): __tablename__ = "unauthenticated_users" id = db.Column(db.Integer, primary_key=True, nullable=False) # Auto increment id guild_id = db.Column( db.String(255), nullable=False) # Guild pretaining to the unauthenticated user username = db.Column(db.String(255), nullable=False) # The username of the user discriminator = db.Column( db.Integer, nullable=False ) # The discriminator to distinguish unauth users with each other user_key = db.Column( db.Text(), nullable=False) # The secret key used to identify the user holder ip_address = db.Column(db.String(255), nullable=False) # The IP Address of the user last_timestamp = db.Column( db.TIMESTAMP, nullable=False ) # The timestamp of when the user has last sent the heartbeat revoked = db.Column( db.Boolean(), nullable=False ) # If the user's key has been revoked and a new one is required to be generated def __init__(self, guild_id, username, discriminator, ip_address): self.guild_id = guild_id self.username = username self.discriminator = discriminator self.user_key = "".join( random.choice(string.ascii_letters) for _ in range(0, 32)) self.ip_address = ip_address self.last_timestamp = datetime.datetime.fromtimestamp( time.time()).strftime('%Y-%m-%d %H:%M:%S') self.revoked = False def __repr__(self): return '<UnauthenticatedUsers {0} {1} {2} {3} {4} {5} {6} {7}>'.format( self.id, self.guild_id, self.username, self.discriminator, self.user_key, self.ip_address, self.last_timestamp, self.revoked) def isRevoked(self): return self.revoked def changeUsername(self, username): self.username = username db.session.commit() return self.username def revokeUser(self): self.revoked = True db.session.commit() return self.revoked def bumpTimestamp(self): self.last_timestamp = datetime.datetime.fromtimestamp( time.time()).strftime('%Y-%m-%d %H:%M:%S') db.session.commit() return self.last_timestamp
class AuthenticatedUsers(db.Model): __tablename__ = "authenticated_users" id = db.Column(db.Integer, primary_key=True) # Auto increment id guild_id = db.Column(db.String(255), nullable=False) # Guild pretaining to the authenticated user client_id = db.Column(db.String(255), nullable=False) # Client ID of the authenticated user last_timestamp = db.Column(db.TIMESTAMP, nullable=False) # The timestamp of when the user has last sent the heartbeat def __init__(self, guild_id, client_id): self.guild_id = guild_id self.client_id = client_id self.last_timestamp = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S') def bumpTimestamp(self): self.last_timestamp = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S') db.session.commit() return self.last_timestamp
class DisabledGuilds(db.Model): __tablename__ = "disabled_guilds" # Auto increment id guild_id = db.Column(db.BigInteger, nullable=False, primary_key=True) # Server id that is disabled def __init__(self, guild_id): self.guild_id = guild_id
class ApplicationSettings(db.Model): __tablename__ = "application_settings" id = db.Column(db.Integer, primary_key=True, nullable=False) # Auto increment id donation_goal_progress = db.Column( db.Integer, nullable=False, server_default="0") # Current progress towards donation goal donation_goal_total = db.Column( db.Integer, nullable=False, server_default="0" ) # Total donation required to hit goal. 0 to now show banners donation_goal_end = db.Column(db.Date(), nullable=True) # When to end donation goal def __init__(self): self.donation_goal_progress = 0 self.donation_goal_total = 0 self.donation_goal_end = None
class TokenTransactions(db.Model): __tablename__ = "token_transactions" id = db.Column(db.Integer, primary_key=True) # Auto increment id user_id = db.Column(db.String(255), nullable=False) # Discord user id of user timestamp = db.Column( db.TIMESTAMP, nullable=False) # The timestamp of when the action took place action = db.Column(db.String(255), nullable=False) # Very short description of the action net_tokens = db.Column(db.Integer, nullable=False) # Net change of the token amount start_tokens = db.Column(db.Integer, nullable=False) # Token amount before transaction end_tokens = db.Column(db.Integer, nullable=False) # Tokens after transaction def __init__(self, user_id, action, net_tokens, start_tokens, end_tokens): self.user_id = user_id self.timestamp = datetime.datetime.fromtimestamp( time.time()).strftime('%Y-%m-%d %H:%M:%S') self.action = action self.net_tokens = net_tokens self.start_tokens = start_tokens self.end_tokens = end_tokens
class UnauthenticatedBans(db.Model): __tablename__ = "unauthenticated_bans" id = db.Column(db.Integer, primary_key=True) # Auto increment id guild_id = db.Column( db.String(255)) # Guild pretaining to the unauthenticated user ip_address = db.Column(db.String(255)) # The IP Address of the user last_username = db.Column( db.String(255)) # The username when they got banned last_discriminator = db.Column( db.Integer) # The discrim when they got banned timestamp = db.Column( db.TIMESTAMP) # The timestamp of when the user got banned reason = db.Column( db.Text()) # The reason of the ban set by the guild moderators lifter_id = db.Column( db.BigInteger) # Discord Client ID of the user who lifted the ban placer_id = db.Column(db.BigInteger) # The id of who placed the ban
class UserCSS(db.Model): __tablename__ = "user_css" id = db.Column(db.Integer, primary_key=True) # Auto increment id name = db.Column(db.String(255), nullable=False) # CSS Name user_id = db.Column( db.String(255), nullable=False) # Discord client ID of the owner of the css (can edit) css_var_bool = db.Column( db.Boolean(), nullable=False, server_default="0" ) # If css variables should be taken into consideration css_variables = db.Column(db.Text()) # Customizeable CSS Variables css = db.Column(db.Text().with_variant(db.Text(4294967295), 'mysql')) # CSS contents def __init__(self, name, user_id, css_var_bool=False, css_variables=None, css=None): self.name = name self.user_id = user_id self.css_var_bool = css_var_bool self.css_variables = css_variables self.css = css
class Cosmetics(db.Model): __tablename__ = "cosmetics" user_id = db.Column( db.BigInteger, nullable=False, primary_key=True) # Discord user id of user of cosmetics css = db.Column(db.Boolean(), nullable=False) # If they can create/edit custom CSS css_limit = db.Column(db.Integer, nullable=False, server_default="0") # Custom CSS Limit guest_icon = db.Column(db.Boolean(), nullable=False, server_default=db.false() ) # If they can set the guest icon for all guilds badges = db.Column( db.String(255), nullable=False, server_default="[]") # JSON list of all the badges the user has def __init__(self, user_id, **kwargs): self.user_id = user_id if "css" in kwargs: self.css = kwargs["css"] else: self.css = False if "css_limit" in kwargs: self.css_limit = kwargs["css_limit"] else: self.css_limit = 0 if "guest_icon" in kwargs: self.guest_icon = kwargs["guest_icon"] else: self.guest_icon = False if "badges" in kwargs: self.badges = json.dumps(kwargs["badges"]) else: self.badges = "[]"
class UnauthenticatedUsers(db.Model): __tablename__ = "unauthenticated_users" id = db.Column(db.Integer, primary_key=True) # Auto increment id guild_id = db.Column( db.BigInteger) # Guild pretaining to the unauthenticated user username = db.Column(db.String(255)) # The username of the user discriminator = db.Column( db.Integer ) # The discriminator to distinguish unauth users with each other user_key = db.Column( db.Text()) # The secret key used to identify the user holder ip_address = db.Column(db.String(255)) # The IP Address of the user revoked = db.Column( db.Boolean() ) # If the user's key has been revoked and a new one is required to be generated
class UnauthenticatedUsers(db.Model): __tablename__ = "unauthenticated_users" id = db.Column(db.Integer, primary_key=True, nullable=False) # Auto increment id guild_id = db.Column( db.BigInteger, nullable=False) # Guild pretaining to the unauthenticated user username = db.Column(db.String(255), nullable=False) # The username of the user discriminator = db.Column( db.Integer, nullable=False ) # The discriminator to distinguish unauth users with each other user_key = db.Column( db.Text(), nullable=False) # The secret key used to identify the user holder ip_address = db.Column(db.String(255), nullable=False) # The IP Address of the user revoked = db.Column( db.Boolean(), nullable=False ) # If the user's key has been revoked and a new one is required to be generated def __init__(self, guild_id, username, discriminator, ip_address): self.guild_id = guild_id self.username = username self.discriminator = discriminator self.user_key = "".join( random.choice(string.ascii_letters) for _ in range(0, 32)) self.ip_address = ip_address self.revoked = False def __repr__(self): return '<UnauthenticatedUsers {0} {1} {2} {3} {4} {5} {6}>'.format( self.id, self.guild_id, self.username, self.discriminator, self.user_key, self.ip_address, self.revoked) def isRevoked(self): return self.revoked def changeUsername(self, username): self.username = username return self.username def revokeUser(self): self.revoked = True return self.revoked
class UnauthenticatedUsers(Base): __tablename__ = "unauthenticated_users" id = db.Column(db.Integer, primary_key=True) # Auto increment id guild_id = db.Column( db.String(255)) # Guild pretaining to the unauthenticated user username = db.Column(db.String(255)) # The username of the user discriminator = db.Column( db.Integer ) # The discriminator to distinguish unauth users with each other user_key = db.Column( db.Text()) # The secret key used to identify the user holder ip_address = db.Column(db.String(255)) # The IP Address of the user last_timestamp = db.Column( db.TIMESTAMP ) # The timestamp of when the user has last sent the heartbeat revoked = db.Column( db.Boolean() ) # If the user's key has been revoked and a new one is required to be generated def __repr__(self): return '<UnauthenticatedUsers {0} {1} {2} {3} {4} {5} {6} {7}>'.format( self.id, self.guild_id, self.username, self.discriminator, self.user_key, self.ip_address, self.last_timestamp, self.revoked)
class Guilds(db.Model): __tablename__ = "guilds" guild_id = db.Column(db.BigInteger, nullable=False, primary_key=True) # Discord guild id unauth_users = db.Column(db.Boolean(), nullable=False, default=1) # If allowed unauth users visitor_view = db.Column( db.Boolean(), nullable=False, default=0) # If users are automatically "signed in" and can view chat webhook_messages = db.Column( db.Boolean(), nullable=False, default=0) # Use webhooks to send messages instead of the bot guest_icon = db.Column(db.String(255), default=None) # Guest icon url, None if unset chat_links = db.Column(db.Boolean(), nullable=False, default=1) # If users can post links bracket_links = db.Column( db.Boolean(), nullable=False, default=1) # If appending brackets to links to prevent embed unauth_captcha = db.Column( db.Boolean(), nullable=False, server_default="1") # Enforce captcha on guest users mentions_limit = db.Column( db.Integer, nullable=False, default=11) # If there is a limit on the number of mentions in a msg invite_link = db.Column(db.String(255)) # Custom Discord Invite Link post_timeout = db.Column( db.Integer, nullable=False, server_default="5" ) # Seconds to elapse before another message can be posted from the widget max_message_length = db.Column( db.Integer, nullable=False, server_default="300" ) # Chars length the message should be before being rejected by the server banned_words_enabled = db.Column( db.Boolean(), nullable=False, server_default="0") # If banned words are enforced banned_words_global_included = db.Column( db.Boolean(), nullable=False, server_default="0") # Add global banned words to the list banned_words = db.Column( db.Text(), nullable=False, server_default="[]") # JSON list of strings to block from sending autorole_unauth = db.Column( db.BigInteger, nullable=True, server_default=None ) # Automatic Role inherit for unauthenticated users autorole_discord = db.Column( db.BigInteger, nullable=True, server_default=None) # Automatic Role inherit for discord users file_upload = db.Column( db.Boolean(), nullable=False, server_default="0") # Allow file uploading for server def __init__(self, guild_id): self.guild_id = guild_id self.unauth_users = True # defaults to true self.visitor_view = False self.webhook_messages = False self.guest_icon = None self.chat_links = True self.bracket_links = True self.unauth_captcha = True self.mentions_limit = -1 # -1 = unlimited mentions def __repr__(self): return '<Guilds {0}>'.format(self.guild_id) def set_unauthUsersBool(self, value): self.unauth_users = value return self.unauth_users
class Guilds(Base): __tablename__ = "guilds" guild_id = db.Column(db.BigInteger, primary_key=True) # Discord guild id name = db.Column(db.String(255)) # Name unauth_users = db.Column(db.Boolean()) # If allowed unauth users visitor_view = db.Column(db.Boolean( )) # If users are automatically "signed in" and can view chat webhook_messages = db.Column( db.Boolean()) # Use webhooks to send messages instead of the bot guest_icon = db.Column(db.String(255), default=None) # Guest icon url, None if unset chat_links = db.Column(db.Boolean()) # If users can post links bracket_links = db.Column( db.Boolean()) # If appending brackets to links to prevent embed unauth_captcha = db.Column( db.Boolean(), nullable=False, server_default="1") # Enforce captcha on guest users mentions_limit = db.Column( db.Integer) # If there is a limit on the number of mentions in a msg roles = db.Column(db.Text().with_variant(db.Text(length=4294967295), 'mysql')) # Guild Roles channels = db.Column(db.Text().with_variant(db.Text(length=4294967295), 'mysql')) # Guild channels webhooks = db.Column(db.Text().with_variant(db.Text(length=4294967295), 'mysql')) # Guild webhooks emojis = db.Column(db.Text().with_variant(db.Text(length=4294967295), 'mysql')) # Guild Emojis owner_id = db.Column(db.BigInteger) # Snowflake of the owner icon = db.Column(db.String(255)) # The icon string, null if none invite_link = db.Column(db.String(255)) # Custom Discord Invite Link def __init__(self, guild_id, name, roles, channels, webhooks, emojis, owner_id, icon): self.guild_id = guild_id self.name = name self.unauth_users = True # defaults to true self.visitor_view = False self.webhook_messages = False self.guest_icon = None self.chat_links = True self.bracket_links = True self.unauth_captcha = True self.mentions_limit = -1 # -1 = unlimited mentions self.roles = roles self.channels = channels self.webhooks = webhooks self.emojis = emojis self.owner_id = owner_id self.icon = icon def __repr__(self): return '<Guilds {0} {1}>'.format(self.id, self.guild_id)
class Guilds(db.Model): __tablename__ = "guilds" guild_id = db.Column(db.BigInteger, nullable=False, primary_key=True) # Discord guild id name = db.Column(db.String(255), nullable=False) # Name unauth_users = db.Column(db.Boolean(), nullable=False, default=1) # If allowed unauth users visitor_view = db.Column( db.Boolean(), nullable=False, default=0) # If users are automatically "signed in" and can view chat webhook_messages = db.Column( db.Boolean(), nullable=False, default=0) # Use webhooks to send messages instead of the bot guest_icon = db.Column(db.String(255), default=None) # Guest icon url, None if unset chat_links = db.Column(db.Boolean(), nullable=False, default=1) # If users can post links bracket_links = db.Column( db.Boolean(), nullable=False, default=1) # If appending brackets to links to prevent embed unauth_captcha = db.Column( db.Boolean(), nullable=False, server_default="1") # Enforce captcha on guest users mentions_limit = db.Column( db.Integer, nullable=False, default=11) # If there is a limit on the number of mentions in a msg roles = db.Column(db.Text().with_variant(db.Text(4294967295), 'mysql'), nullable=False) # Guild Roles channels = db.Column(db.Text().with_variant(db.Text(4294967295), 'mysql'), nullable=False) # Guild channels webhooks = db.Column(db.Text().with_variant(db.Text(4294967295), 'mysql'), nullable=False) # Guild webhooks emojis = db.Column(db.Text().with_variant(db.Text(4294967295), 'mysql'), nullable=False) # Guild Emojis owner_id = db.Column(db.BigInteger, nullable=False) # Snowflake of the owner icon = db.Column(db.String(255)) # The icon string, null if none invite_link = db.Column(db.String(255)) # Custom Discord Invite Link post_timeout = db.Column( db.Integer, nullable=False, server_default="5" ) # Seconds to elapse before another message can be posted from the widget max_message_length = db.Column( db.Integer, nullable=False, server_default="300" ) # Chars length the message should be before being rejected by the server banned_words_enabled = db.Column( db.Boolean(), nullable=False, server_default="0") # If banned words are enforced banned_words_global_included = db.Column( db.Boolean(), nullable=False, server_default="0") # Add global banned words to the list banned_words = db.Column( db.Text(), nullable=False, server_default="[]") # JSON list of strings to block from sending def __init__(self, guild_id, name, roles, channels, webhooks, emojis, owner_id, icon): self.guild_id = guild_id self.name = name self.unauth_users = True # defaults to true self.visitor_view = False self.webhook_messages = False self.guest_icon = None self.chat_links = True self.bracket_links = True self.unauth_captcha = True self.mentions_limit = -1 # -1 = unlimited mentions self.roles = roles self.channels = channels self.webhooks = webhooks self.emojis = emojis self.owner_id = owner_id self.icon = icon def __repr__(self): return '<Guilds {0} {1}>'.format(self.id, self.guild_id) def set_unauthUsersBool(self, value): self.unauth_users = value return self.unauth_users
class Administrators(db.Model): __tablename__ = "administrators" id = db.Column(db.Integer, primary_key=True) # Auto increment id user_id = db.Column( db.String(255), nullable=False) # Discord user id of user of an administrator
class Guilds(db.Model): __tablename__ = "guilds" id = db.Column(db.Integer, primary_key=True) # Auto incremented id guild_id = db.Column(db.String(255), nullable=False) # Discord guild id name = db.Column(db.String(255), nullable=False) # Name unauth_users = db.Column(db.Boolean(), nullable=False, default=1) # If allowed unauth users visitor_view = db.Column( db.Boolean(), nullable=False, default=0) # If users are automatically "signed in" and can view chat chat_links = db.Column(db.Boolean(), nullable=False, default=1) # If users can post links bracket_links = db.Column( db.Boolean(), nullable=False, default=1) # If appending brackets to links to prevent embed mentions_limit = db.Column( db.Integer, nullable=False, default=11) # If there is a limit on the number of mentions in a msg roles = db.Column(db.Text(4294967295), nullable=False) # Guild Roles channels = db.Column(db.Text(4294967295), nullable=False) # Guild channels webhooks = db.Column(db.Text(4294967295), nullable=False) # Guild webhooks emojis = db.Column(db.Text(4294967295), nullable=False) # Guild Emojis owner_id = db.Column(db.String(255), nullable=False) # Snowflake of the owner icon = db.Column(db.String(255)) # The icon string, null if none discordio = db.Column(db.String(255)) # Custom Discord.io Invite Link def __init__(self, guild_id, name, roles, channels, webhooks, emojis, owner_id, icon): self.guild_id = guild_id self.name = name self.unauth_users = True # defaults to true self.visitor_view = False self.chat_links = True self.bracket_links = True self.mentions_limit = -1 # -1 = unlimited mentions self.roles = roles self.channels = channels self.webhooks = webhooks self.emojis = emojis self.owner_id = owner_id self.icon = icon def __repr__(self): return '<Guilds {0} {1}>'.format(self.id, self.guild_id) def set_unauthUsersBool(self, value): self.unauth_users = value db.session.commit() return self.unauth_users