Skip to content

Commit aff2ed6

Browse files
committed
Add permission checks
1 parent ef75ada commit aff2ed6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cogs/ui.py

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class ui(commands.Cog):
1111
def __init__(self, bot):
1212
self.bot = bot
1313

14+
@commands.check_any(commands.is_owner(), commands.has_permissions(administrator=True))
1415
@commands.command(name='list', aliases=['scoreboards', 'sbs', 'list_scoreboards'])
1516
async def list_scoreboards(self, ctx):
1617
embed = discord.Embed()
@@ -208,6 +209,7 @@ def validate_server_id():
208209
server_id = int(server_id)
209210
return server_id
210211

212+
@commands.check_any(commands.is_owner(), commands.has_permissions(administrator=True))
211213
@commands.command(name='create', aliases=['create_sb', 'create_scoreboard', 'add', 'add_sb', 'add_scoreboard'])
212214
async def create_scoreboard(self, ctx):
213215

@@ -254,6 +256,7 @@ async def get_scoreboard(self, ctx, message, return_index=False):
254256
raise commands.BadArgument('No scoreboard found with message id %s' % message)
255257
return (sb, i) if return_index else sb
256258

259+
@commands.check_any(commands.is_owner(), commands.has_permissions(administrator=True))
257260
@commands.command(name='delete', aliases=['delete_sb', 'delete_scoreboard', 'remove', 'remove_sb', 'remove_scoreboard'])
258261
async def delete_scoreboard(self, ctx, message):
259262
sb = await self.get_scoreboard(ctx, message)
@@ -272,6 +275,7 @@ async def delete_scoreboard(self, ctx, message):
272275
embed.set_author(name=f"Scoreboard deleted", icon_url="https://cdn.discordapp.com/emojis/809149148356018256.png")
273276
await ctx.send(embed=embed)
274277

278+
@commands.check_any(commands.is_owner(), commands.has_permissions(administrator=True))
275279
@commands.group(name='set', aliases=['edit', 'update', 'set_scoreboard', 'edit_scoreboard', 'update_scoreboard'], invoke_without_command=False)
276280
async def set_scoreboard(self, ctx, message, option: str):
277281
sb, sb_index = await self.get_scoreboard(ctx, message, return_index=True)

0 commit comments

Comments
 (0)