mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-21 21:27:48 +00:00
WIP Cleaning up the code base + impl slash commands
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
import aiomysql
|
||||
import asyncio
|
||||
from bot import CloudKid
|
||||
from aiomysql.sa import SAConnection
|
||||
from sqlalchemy import Table
|
||||
from typing import Sequence
|
||||
|
||||
|
||||
class AutoJoin:
|
||||
@staticmethod
|
||||
async def get_channels(bot: CloudKid) -> Sequence[tuple]:
|
||||
autojoin: Table = bot.database.tables["autojoin"]
|
||||
conn: SAConnection = await bot.database.engine.acquire()
|
||||
result = await conn.execute(autojoin.select())
|
||||
channels: Sequence[tuple] = await result.fetchall()
|
||||
return channels
|
||||
|
||||
@staticmethod
|
||||
async def update_channel(bot, guild_id, channel_id):
|
||||
autojoin: Table = bot.database.tables["autojoin"]
|
||||
conn: SAConnection = await bot.database.engine.acquire()
|
||||
await conn.execute(autojoin.insert().values({
|
||||
"guild_id": guild_id,
|
||||
"channel_id": channel_id
|
||||
}))
|
||||
|
||||
@staticmethod
|
||||
async def del_channel(bot, guild_id):
|
||||
autojoin: Table = bot.database.tables["autojoin"]
|
||||
conn: SAConnection = await bot.database.engine.acquire()
|
||||
await conn.execute(
|
||||
autojoin.delete().where(autojoin.c.guild_id == guild_id))
|
||||
Reference in New Issue
Block a user