This commit is contained in:
tumGER 2018-12-23 17:17:12 +01:00
commit e2e7456b8f
2 changed files with 10 additions and 0 deletions

View file

@ -18,12 +18,14 @@ class AdminCog:
def check_if_bot_manager(ctx): def check_if_bot_manager(ctx):
return any(r.id == config.bot_manager_role_id for r in ctx.author.roles) return any(r.id == config.bot_manager_role_id for r in ctx.author.roles)
@commands.guild_only()
@commands.check(check_if_staff) @commands.check(check_if_staff)
@commands.command(aliases=['echo'], hidden=True) @commands.command(aliases=['echo'], hidden=True)
async def say(self, ctx, *, the_text: str): async def say(self, ctx, *, the_text: str):
"""Repeats a given text, staff only.""" """Repeats a given text, staff only."""
await ctx.send(the_text) await ctx.send(the_text)
@commands.guild_only()
@commands.check(check_if_bot_manager) @commands.check(check_if_bot_manager)
@commands.command(name='exit', hidden=True) @commands.command(name='exit', hidden=True)
async def _exit(self, ctx): async def _exit(self, ctx):
@ -31,6 +33,7 @@ class AdminCog:
await ctx.send(":wave: Exiting bot, goodbye!") await ctx.send(":wave: Exiting bot, goodbye!")
await self.bot.logout() await self.bot.logout()
@commands.guild_only()
@commands.check(check_if_bot_manager) @commands.check(check_if_bot_manager)
@commands.command(hidden=True) @commands.command(hidden=True)
async def load(self, ctx, ext: str): async def load(self, ctx, ext: str):
@ -44,6 +47,7 @@ class AdminCog:
self.bot.log.info(f'Loaded ext {ext}') self.bot.log.info(f'Loaded ext {ext}')
await ctx.send(f':white_check_mark: `{ext}` successfully loaded.') await ctx.send(f':white_check_mark: `{ext}` successfully loaded.')
@commands.guild_only()
@commands.check(check_if_bot_manager) @commands.check(check_if_bot_manager)
@commands.command(hidden=True) @commands.command(hidden=True)
async def fetchlog(self, ctx): async def fetchlog(self, ctx):
@ -51,6 +55,7 @@ class AdminCog:
await ctx.send(file=discord.File(f"{self.bot.script_name}.log"), await ctx.send(file=discord.File(f"{self.bot.script_name}.log"),
content="Here's the current log file:") content="Here's the current log file:")
@commands.guild_only()
@commands.check(check_if_bot_manager) @commands.check(check_if_bot_manager)
@commands.command(name='eval', hidden=True) @commands.command(name='eval', hidden=True)
async def _eval(self, ctx, *, code: str): async def _eval(self, ctx, *, code: str):
@ -104,6 +109,7 @@ class AdminCog:
for msg in sliced_message: for msg in sliced_message:
await ctx.send(msg) await ctx.send(msg)
@commands.guild_only()
@commands.check(check_if_bot_manager) @commands.check(check_if_bot_manager)
@commands.command(hidden=True) @commands.command(hidden=True)
async def pull(self, ctx, auto=False): async def pull(self, ctx, auto=False):
@ -125,6 +131,7 @@ class AdminCog:
f'```\n{traceback.format_exc()}\n```') f'```\n{traceback.format_exc()}\n```')
return return
@commands.guild_only()
@commands.check(check_if_bot_manager) @commands.check(check_if_bot_manager)
@commands.command(hidden=True) @commands.command(hidden=True)
async def sh(self, ctx, *, command: str): async def sh(self, ctx, *, command: str):
@ -145,6 +152,7 @@ class AdminCog:
for msg in sliced_message: for msg in sliced_message:
await ctx.send(msg) await ctx.send(msg)
@commands.guild_only()
@commands.check(check_if_bot_manager) @commands.check(check_if_bot_manager)
@commands.command(hidden=True) @commands.command(hidden=True)
async def unload(self, ctx, ext: str): async def unload(self, ctx, ext: str):

View file

@ -13,6 +13,7 @@ class ModCog:
def check_if_target_is_staff(self, target): def check_if_target_is_staff(self, target):
return any(r.id in config.staff_role_ids for r in target.roles) return any(r.id in config.staff_role_ids for r in target.roles)
@commands.guild_only()
@commands.bot_has_permissions(kick_members=True) @commands.bot_has_permissions(kick_members=True)
@commands.check(check_if_staff) @commands.check(check_if_staff)
@commands.command() @commands.command()
@ -51,6 +52,7 @@ class ModCog:
modlog_channel = self.bot.get_channel(config.modlog_channel) modlog_channel = self.bot.get_channel(config.modlog_channel)
await modlog_channel.send(chan_message) await modlog_channel.send(chan_message)
@commands.guild_only()
@commands.bot_has_permissions(ban_members=True) @commands.bot_has_permissions(ban_members=True)
@commands.check(check_if_staff) @commands.check(check_if_staff)
@commands.command() @commands.command()