2017-02-10 06:10:44 +01:00
|
|
|
from titanembeds.database import db
|
|
|
|
|
|
|
|
class Guilds(db.Model):
|
|
|
|
__tablename__ = "guilds"
|
2018-01-23 22:08:55 +01:00
|
|
|
guild_id = db.Column(db.BigInteger, nullable=False, primary_key=True) # Discord guild id
|
2017-06-04 07:05:55 +02:00
|
|
|
unauth_users = db.Column(db.Boolean(), nullable=False, default=1) # If allowed unauth users
|
2017-06-09 06:22:33 +02:00
|
|
|
visitor_view = db.Column(db.Boolean(), nullable=False, default=0) # If users are automatically "signed in" and can view chat
|
2017-08-27 23:41:36 +02:00
|
|
|
webhook_messages = db.Column(db.Boolean(), nullable=False, default=0) # Use webhooks to send messages instead of the bot
|
2017-09-24 03:22:07 +02:00
|
|
|
guest_icon = db.Column(db.String(255), default=None) # Guest icon url, None if unset
|
2017-06-04 07:05:55 +02:00
|
|
|
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
|
2017-11-04 03:58:26 +01:00
|
|
|
unauth_captcha = db.Column(db.Boolean(), nullable=False, server_default="1")# Enforce captcha on guest users
|
2017-06-04 07:05:55 +02:00
|
|
|
mentions_limit = db.Column(db.Integer, nullable=False, default=11) # If there is a limit on the number of mentions in a msg
|
2018-01-13 19:37:42 +01:00
|
|
|
invite_link = db.Column(db.String(255)) # Custom Discord Invite Link
|
2018-03-25 06:43:39 +02:00
|
|
|
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
|
2018-07-09 03:37:35 +02:00
|
|
|
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
|
2018-07-22 08:46:03 +02:00
|
|
|
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
|
2017-02-10 06:10:44 +01:00
|
|
|
|
2018-07-21 01:10:24 +02:00
|
|
|
def __init__(self, guild_id):
|
2017-02-10 06:10:44 +01:00
|
|
|
self.guild_id = guild_id
|
2017-03-26 05:31:47 +02:00
|
|
|
self.unauth_users = True # defaults to true
|
2017-06-09 06:22:33 +02:00
|
|
|
self.visitor_view = False
|
2017-08-27 23:41:36 +02:00
|
|
|
self.webhook_messages = False
|
2017-09-24 03:22:07 +02:00
|
|
|
self.guest_icon = None
|
2017-05-09 02:55:07 +02:00
|
|
|
self.chat_links = True
|
|
|
|
self.bracket_links = True
|
2017-11-04 03:58:26 +01:00
|
|
|
self.unauth_captcha = True
|
2017-05-09 02:55:07 +02:00
|
|
|
self.mentions_limit = -1 # -1 = unlimited mentions
|
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
|
|
|
|
return self.unauth_users
|