From 530a58d86091e14f915a5fffb5d1d81b7710ebd1 Mon Sep 17 00:00:00 2001 From: ctmbl Date: Sun, 27 Oct 2024 19:06:21 +0100 Subject: [PATCH] Add pause command --- src/bot/root_pythia_cogs.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/bot/root_pythia_cogs.py b/src/bot/root_pythia_cogs.py index 13fcd87..c7b6e03 100644 --- a/src/bot/root_pythia_cogs.py +++ b/src/bot/root_pythia_cogs.py @@ -49,6 +49,21 @@ async def status(self, ctx): f"- alive: {bot_loop_alive}\n" ) + @commands.command(name="pause") + async def pause(self, ctx): + """ + The bot enters its idle state + """ + rate_limiter = self.dbmanager.get_api_manager().get_rate_limiter() + if rate_limiter.is_idle(): + await ctx.message.channel.send("The Rate Limiter is already idle, can't pause.") + return + + rate_limiter.go_idle(manually = True) + await ctx.message.channel.send( + "Bot is in idle state, no requests will be sent." + ) + @commands.command(name="resume") async def resume(self, ctx): """