Removed self invocation again, didn't work

This commit is contained in:
unknown 2023-06-03 17:02:48 +02:00
parent fdef7189a1
commit 8d2b140e38

View File

@ -32,13 +32,13 @@ class ReginaldCog(commands.Cog):
self.allowed_role_id = int(config['DEFAULT']['allowed_role_id']) self.allowed_role_id = int(config['DEFAULT']['allowed_role_id'])
def has_allowed_role(self): def has_allowed_role():
async def predicate(ctx): def predicate(ctx):
return any(role.id == self.allowed_role_id for role in ctx.author.roles) return any(role.id == ctx.cog.allowed_role_id for role in ctx.author.roles)
return commands.check(predicate) return commands.check(predicate)
def has_admin_role(self): def has_admin_role():
async def predicate(ctx): def predicate(ctx):
has_admin_permission = ctx.author.guild_permissions.administrator has_admin_permission = ctx.author.guild_permissions.administrator
return has_admin_permission return has_admin_permission
return commands.check(predicate) return commands.check(predicate)
@ -52,7 +52,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()
@self.has_allowed_role() @has_allowed_role()
@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):
@ -112,7 +112,7 @@ class ReginaldCog(commands.Cog):
return chunks return chunks
@commands.guild_only() @commands.guild_only()
@self.has_admin_role() @has_admin_role()
@commands.command(help="Ask Reginald to generate an image based on a prompt") @commands.command(help="Ask Reginald to generate an image based on a prompt")
@commands.cooldown(1, 300, commands.BucketType.user) # 5-minute cooldown per user @commands.cooldown(1, 300, commands.BucketType.user) # 5-minute cooldown per user
async def reginaldimagine(self, ctx, *, prompt=None): async def reginaldimagine(self, ctx, *, prompt=None):