From cb745bc8b13fc1881228e41b503ff52996406210 Mon Sep 17 00:00:00 2001 From: Corban-Lee Jones Date: Fri, 6 Dec 2024 09:45:32 +0000 Subject: [PATCH] activity handler --- cogs/activity.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 cogs/activity.py diff --git a/cogs/activity.py b/cogs/activity.py new file mode 100644 index 0000000..64cbdfb --- /dev/null +++ b/cogs/activity.py @@ -0,0 +1,35 @@ +""" +Handles the activity displayed on the bot's Discord profile. +The current intent is to display the server's player count as the activity. +""" + +import logging + +from discord import Activity +from discord.ext import commands, tasks + +log = logging.getLogger(__name__) + + +class CommandCog(commands.Cog): + """ + Handles the bot's profile activity. + """ + def __init__(self, bot: commands.Bot): + self.bot = bot + + @tasks.loop(seconds=30) + async def update_activity(self): + """ + Update the bot's profile activity on an interval of 30 seconds. + """ + log.debug("updating activity") + + self.bot. + + + +async def setup(bot: commands.Bot): + cog = CommandCog(bot) + await bot.add_cog(cog) + log.info("Added %s cog", cog.__class__.__name__)