From 46756e663d7bd3afd9af1e82b60ea6c4436ac1be Mon Sep 17 00:00:00 2001 From: snipe <72265661+notsniped@users.noreply.github.com> Date: Thu, 9 Mar 2023 04:10:18 +0000 Subject: [PATCH] Move `/prediction` from main file to fun cog --- cogs/fun.py | 9 +++++++++ main.py | 7 ------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/cogs/fun.py b/cogs/fun.py index 0c0b3040..d3e4d116 100644 --- a/cogs/fun.py +++ b/cogs/fun.py @@ -34,5 +34,14 @@ async def stroketranslate(self, ctx: ApplicationContext, strok: str): var = ''.join(arr) await ctx.respond(f"{var}") + @commands.slash_command( + name='prediction', + description='Randomly predicts a yes/no question.' + ) + @option(name="question", description="What do you want to predict?", type=str) + async def prediction(self, ctx: ApplicationContext, question: str): + await ctx.respond(f"My prediction is... **{random.choice(['Yes', 'No'])}!**") + + # Initialization def setup(bot): bot.add_cog(Fun(bot)) diff --git a/main.py b/main.py index cb04f10e..9a6f47b6 100644 --- a/main.py +++ b/main.py @@ -256,13 +256,6 @@ async def sync(ctx: ApplicationContext): print(e) await ctx.respond('An error occured while resyncing. Check console.', ephemeral=True) -@client.slash_command( - name='prediction', - description='Randomly predicts a yes/no question.' -) -@option(name="question", description="What do you want to predict?", type=str) -async def prediction(ctx: ApplicationContext, question:str): await ctx.respond(f"My prediction is... **{random.choice(['Yes', 'No'])}!**") - # Cog Commands (these cannot be moved into a cog) cogs = client.create_group("cog", "Commands for working with isobot cogs.")