diff options
Diffstat (limited to 'code/bot.py')
-rw-r--r-- | code/bot.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/code/bot.py b/code/bot.py index b7654c6..919f394 100644 --- a/code/bot.py +++ b/code/bot.py @@ -1,10 +1,9 @@ import discord -from discord.ext import commands -from discord.ext import tasks +from discord.ext import commands, tasks import os +from utils.database import Base, engine import utils.config as config -from utils.jellyfin_delete import delete_accounts class MyBot(commands.Bot): @@ -15,7 +14,7 @@ class MyBot(commands.Bot): ) async def setup_hook(self): - delete_old_temp_accounts.start() + delete_accounts_task.start() for ext in os.listdir("./code/cogs"): if ext.endswith(".py"): await self.load_extension(f"cogs.{ext[:-3]}") @@ -30,8 +29,11 @@ async def on_ready(): config.LOG.info(f"{bot.user} has connected to Discord.") -@tasks.loop(seconds=60) -async def delete_old_temp_accounts(): +@tasks.loop(minutes=1) +async def delete_accounts_task(): + from utils.jellyfin_delete import delete_accounts + + Base.metadata.create_all(bind=engine) delete_accounts() |