mirror of
https://github.com/RPCS3/discord-bot.git
synced 2024-12-04 00:43:10 +00:00
30 lines
599 B
Python
30 lines
599 B
Python
from peewee import *
|
|
|
|
from bot_config import bot_admin_id
|
|
|
|
db = SqliteDatabase('bot.db')
|
|
|
|
|
|
class BaseModel(Model):
|
|
class Meta:
|
|
database = db
|
|
|
|
|
|
class Moderator(BaseModel):
|
|
discord_id = IntegerField(unique=True)
|
|
sudoer = BooleanField(default=False)
|
|
|
|
|
|
class PiracyString(BaseModel):
|
|
string = CharField(unique=True)
|
|
|
|
|
|
def init():
|
|
with db:
|
|
db.get_tables()
|
|
db.create_tables([Moderator, PiracyString])
|
|
try:
|
|
Moderator.get(discord_id=bot_admin_id)
|
|
except DoesNotExist:
|
|
Moderator(discord_id=bot_admin_id, sudoer=True).save()
|