Skip to content

Commit 8812bef

Browse files
committed
Fix permission errors with sub commands
1 parent d451087 commit 8812bef

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

cogs/modmail.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ async def snippets(self, ctx):
9898
await session.run()
9999

100100
@snippets.command(name='add')
101+
@checks.has_permissions(manage_messages=True)
101102
async def add_(self, ctx, name: str.lower, *, value):
102103
"""Add a snippet to the bot config."""
103104
if 'snippets' not in self.bot.config.cache:
@@ -115,6 +116,7 @@ async def add_(self, ctx, name: str.lower, *, value):
115116
await ctx.send(embed=embed)
116117

117118
@snippets.command(name='del')
119+
@checks.has_permissions(manage_messages=True)
118120
async def del_(self, ctx, *, name: str.lower):
119121
"""Removes a snippet from bot config."""
120122

cogs/utility.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ async def config(self, ctx):
405405
await ctx.invoke(cmd, command='config')
406406

407407
@config.command()
408+
@commands.is_owner()
408409
async def options(self, ctx):
409410
"""Return a list of valid config keys you can change."""
410411
allowed = self.bot.config.allowed_to_change_in_command
@@ -415,6 +416,7 @@ async def options(self, ctx):
415416
return await ctx.send(embed=embed)
416417

417418
@config.command()
419+
@commands.is_owner()
418420
async def set(self, ctx, key: str.lower, *, value):
419421
"""
420422
Sets a configuration variable and its value
@@ -446,6 +448,7 @@ async def set(self, ctx, key: str.lower, *, value):
446448
return await ctx.send(embed=embed)
447449

448450
@config.command(name='del')
451+
@commands.is_owner()
449452
async def del_config(self, ctx, key: str.lower):
450453
"""Deletes a key from the config."""
451454
keys = self.bot.config.allowed_to_change_in_command
@@ -473,6 +476,7 @@ async def del_config(self, ctx, key: str.lower):
473476
return await ctx.send(embed=embed)
474477

475478
@config.command()
479+
@commands.is_owner()
476480
async def get(self, ctx, key=None):
477481
"""Shows the config variables that are currently set."""
478482
keys = self.bot.config.allowed_to_change_in_command
@@ -555,6 +559,7 @@ async def alias(self, ctx):
555559
return await session.run()
556560

557561
@alias.command(name='add')
562+
@checks.has_permissions(manage_messages=True)
558563
async def add_(self, ctx, name: str.lower, *, value):
559564
"""Add an alias to the bot config."""
560565
if 'aliases' not in self.bot.config.cache:
@@ -590,6 +595,7 @@ async def add_(self, ctx, name: str.lower, *, value):
590595
return await ctx.send(embed=embed)
591596

592597
@alias.command(name='del')
598+
@checks.has_permissions(manage_messages=True)
593599
async def del_alias(self, ctx, *, name: str.lower):
594600
"""Removes a alias from bot config."""
595601

0 commit comments

Comments
 (0)