2017-02-10 06:10:44 +01:00
|
|
|
from titanembeds.database import db
|
|
|
|
|
|
|
|
class Guilds(db.Model):
|
|
|
|
__tablename__ = "guilds"
|
2017-06-04 07:05:55 +02:00
|
|
|
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
|
|
|
|
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(), nullable=False) # Guild Roles
|
|
|
|
channels = db.Column(db.Text(), nullable=False) # Guild channels
|
|
|
|
emojis = db.Column(db.Text(), 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
|
2017-06-04 07:31:45 +02:00
|
|
|
discordio = db.Column(db.String(255)) # Custom Discord.io Invite Link
|
2017-02-10 06:10:44 +01:00
|
|
|
|
2017-05-30 00:29:16 +02:00
|
|
|
def __init__(self, guild_id, name, roles, channels, emojis, owner_id, icon):
|
2017-02-10 06:10:44 +01:00
|
|
|
self.guild_id = guild_id
|
2017-05-07 02:19:12 +02:00
|
|
|
self.name = name
|
2017-03-26 05:31:47 +02:00
|
|
|
self.unauth_users = True # defaults to true
|
2017-05-09 02:55:07 +02:00
|
|
|
self.chat_links = True
|
|
|
|
self.bracket_links = True
|
|
|
|
self.mentions_limit = -1 # -1 = unlimited mentions
|
2017-05-07 02:19:12 +02:00
|
|
|
self.roles = roles
|
|
|
|
self.channels = channels
|
2017-05-30 00:29:16 +02:00
|
|
|
self.emojis = emojis
|
2017-05-07 02:19:12 +02:00
|
|
|
self.owner_id = owner_id
|
|
|
|
self.icon = icon
|
2017-02-10 06:10:44 +01:00
|
|
|
|
|
|
|
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
|