Skip to content

Commit

Permalink
use custom help module, temp. rm admin commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayerch1 committed May 1, 2022
1 parent 80a559c commit efccf82
Show file tree
Hide file tree
Showing 7 changed files with 528 additions and 36 deletions.
62 changes: 32 additions & 30 deletions Bot/cogs/AdminModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,42 +34,44 @@ async def on_ready(self):
# commands functions
# =====================

@commands.slash_command(name='load', description='Load a newly added Cog', guild_ids=[ADMIN_GUILD], default_permission=False)
@permissions.is_user(140149964020908032)
async def load_module(self,
ctx: discord.ApplicationContext,
module: discord.Option(str, 'name of the module', required=True)):
# remove admin commands until permissions v2 is implemented
# TODO: implemented once lib support was added
# @commands.slash_command(name='load', description='Load a newly added Cog', guild_ids=[ADMIN_GUILD], default_permission=False)
# @permissions.is_user(140149964020908032)
# async def load_module(self,
# ctx: discord.ApplicationContext,
# module: discord.Option(str, 'name of the module', required=True)):

await ctx.defer(ephemeral=True) # reload may take a while
# await ctx.defer(ephemeral=True) # reload may take a while

try:
self.client.load_extension(module)
except discord.errors.ExtensionError as e:
ex_str = traceback.format_exc()
log.error(ex_str)
await ctx.respond(f'{e.__class__.__name__}: {e}', ephemeral=True)
else:
await ctx.respond('\N{OK HAND SIGN}', ephemeral=True)
log.info(f'Loaded Module: {module}')
# try:
# self.client.load_extension(module)
# except discord.errors.ExtensionError as e:
# ex_str = traceback.format_exc()
# log.error(ex_str)
# await ctx.respond(f'{e.__class__.__name__}: {e}', ephemeral=True)
# else:
# await ctx.respond('\N{OK HAND SIGN}', ephemeral=True)
# log.info(f'Loaded Module: {module}')


@commands.slash_command(name='reload', description='Load a newly added Cog', guild_ids=[ADMIN_GUILD], default_permission=False)
@permissions.is_user(140149964020908032)
async def reload_module(self,
ctx: discord.ApplicationContext,
module: discord.Option(str, 'name of the module', required=True)):
# @commands.slash_command(name='reload', description='Load a newly added Cog', guild_ids=[ADMIN_GUILD], default_permission=False)
# @permissions.is_user(140149964020908032)
# async def reload_module(self,
# ctx: discord.ApplicationContext,
# module: discord.Option(str, 'name of the module', required=True)):

await ctx.defer(ephemeral=True) # reload may take a while
# await ctx.defer(ephemeral=True) # reload may take a while

try:
self.client.reload_extension(module)
except discord.errors.ExtensionError as e:
ex_str = traceback.format_exc()
log.error(ex_str)
await ctx.respond(f'{e.__class__.__name__}: {e}', ephemeral=True)
else:
await ctx.respond('\N{OK HAND SIGN}', ephemeral=True)
log.info(f'Reloaded Module: {module}')
# try:
# self.client.reload_extension(module)
# except discord.errors.ExtensionError as e:
# ex_str = traceback.format_exc()
# log.error(ex_str)
# await ctx.respond(f'{e.__class__.__name__}: {e}', ephemeral=True)
# else:
# await ctx.respond('\N{OK HAND SIGN}', ephemeral=True)
# log.info(f'Reloaded Module: {module}')


def setup(client):
Expand Down
2 changes: 1 addition & 1 deletion Bot/cogs/ReminderCreation.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ async def on_ready(self):
# commands functions
# =====================
# TODO: fix mentionable type, wait for lib fix
@commands.slash_command(name='remind', description='set a reminder after a certain time period', guild_ids=[140150091607441408])
@commands.slash_command(name='remind', description='set a reminder after a certain time period')
async def remind_user(self, ctx:discord.ApplicationContext,
target:discord.Option((discord.Member, discord.Role), 'the user or role you want to remind', required=True),
time:discord.Option(str, 'time/date when the reminder is triggered (see syntax page on /help)', required=True),
Expand Down
3 changes: 3 additions & 0 deletions Bot/discord/ext/help/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .help import Help, HelpPage, HelpException, HelpElement

__version__ = '1.0.0-b'
Loading

0 comments on commit efccf82

Please sign in to comment.