Example #1
0
def setup(bot: TTSBot):
    bot.settings, bot.userinfo, bot.nicknames = (TableHandler[int](
        bot,
        table_name="guilds",
        broadcast=True,
        pkey_columns=("guild_id", ),
        select="SELECT * FROM guilds WHERE guild_id = $1",
        delete="DELETE FROM guilds WHERE guild_id = $1",
    ), TableHandler[int](
        bot,
        table_name="userinfo",
        broadcast=False,
        pkey_columns=("user_id", ),
        select="SELECT * FROM userinfo WHERE user_id = $1",
        delete="DELETE FROM userinfo WHERE user_id = $1",
    ), TableHandler[tuple[int, int]](
        bot,
        table_name="nicknames",
        broadcast=False,
        pkey_columns=("guild_id", "user_id"),
        select="SELECT * from nicknames WHERE guild_id = $1 and user_id = $2",
        delete="DELETE FROM nicknames WHERE guild_id = $1 and user_id = $2",
    ))
def setup(bot: TTSBot):
    bot.settings = GeneralSettings(bot)
    bot.userinfo = UserInfoHandler(bot)
    bot.nicknames = NicknameHandler(bot)