This commit is contained in:
unknown 2023-06-03 18:29:20 +02:00
parent a7a5099031
commit 3d7cf3e2f9

View File

@ -56,8 +56,10 @@ class ReginaldCog(commands.Cog):
else: else:
await ctx.send(f"The {role.name} role is not currently allowed to use the Reginald command.") await ctx.send(f"The {role.name} role is not currently allowed to use the Reginald command.")
def role_check(self, ctx): def role_check(self):
return self.has_admin_role(ctx) or self.has_allowed_role(ctx) async def predicate(ctx):
return await self.has_admin_role(ctx) or await self.has_allowed_role(ctx)
return commands.check(predicate)
@commands.guild_only() @commands.guild_only()
@commands.has_permissions(manage_guild=True) @commands.has_permissions(manage_guild=True)
@ -67,7 +69,7 @@ class ReginaldCog(commands.Cog):
await ctx.send("OpenAI API key set successfully.") await ctx.send("OpenAI API key set successfully.")
@commands.guild_only() @commands.guild_only()
@commands.check(role_check) @commands.check(role_check())
@commands.command(help="Ask Reginald a question") @commands.command(help="Ask Reginald a question")
@commands.cooldown(1, 10, commands.BucketType.user) # 10 second cooldown per user @commands.cooldown(1, 10, commands.BucketType.user) # 10 second cooldown per user
async def reginald(self, ctx, *, prompt=None): async def reginald(self, ctx, *, prompt=None):