Started writing /commands.

Completed channel group of config subcommands
Fixed bugs in config initialisation function
This commit is contained in:
2021-07-17 13:56:04 +01:00
parent 51a01bab49
commit 78bc73c023
11 changed files with 259 additions and 41 deletions

View File

@ -26,7 +26,7 @@ class Debug(commands.Cog, name='Debug Commands'):
async def _reload(self, ctx, cog_category: str='all'):
unloadCogs(cog_category)
loadCogs(cog_category)
await ctx.reply(f'`{cog_category}` cogs have been reloaded.')
await ctx.reply(f'````{cog_category}` cogs have been reloaded.```')
@commands.command(
name='unloadcogs',
@ -36,7 +36,7 @@ class Debug(commands.Cog, name='Debug Commands'):
async def _unloadcogs(self, ctx, cog_category: str='all'):
unloadCogs(cog_category)
loadCogs(cog_category)
await ctx.reply(f'`{cog_category}` cogs have been unloaded.')
await ctx.reply(f'````{cog_category}` cogs have been unloaded.```')
@commands.command(
name='loadcogs',
@ -46,11 +46,11 @@ class Debug(commands.Cog, name='Debug Commands'):
async def _loadcogs(self, ctx, cog_category: str='all'):
unloadCogs(cog_category)
loadCogs(cog_category)
await ctx.reply(f'`{cog_category}` cogs have been loaded.')
await ctx.reply(f'````{cog_category}` cogs have been loaded.```')
@commands.command(
name='deletecommands',
aliases=['delallcommands','deleteslashcommands'],
aliases=['delallcommands','deleteslashcommands','clearcommands','clearslashcommands'],
description='Deletes all the public and guild slash commands registered by the bot.',
brief='Delets all slash commands'
)
@ -65,7 +65,7 @@ class Debug(commands.Cog, name='Debug Commands'):
bot_token=os.getenv('TEST_3_TOKEN'),
guild_ids=[ int(g) for g in yaml_load(configFile)]
)
await ctx.reply('All slash commands have been deleted.')
await ctx.reply('```All slash commands have been deleted.```')
@commands.command(
name='retrievecommands',
@ -76,6 +76,7 @@ class Debug(commands.Cog, name='Debug Commands'):
async def _retrievecommands(self, ctx:commands.Context):
c = await utils.manage_commands.get_all_commands(self.client.user.id,os.getenv('TEST_3_TOKEN'),guild_id=ctx.guild.id)
print(c)
await ctx.reply(f'```All registered `/commands` have been fetched and sent to the Python console.```')
@commands.command(
name='clearconfig',
@ -87,7 +88,7 @@ class Debug(commands.Cog, name='Debug Commands'):
conf = yaml_load(configFile)
for key in list(conf):
clearConfig(key)
await ctx.reply(f'Config entries have been cleared.')
await ctx.reply(f'```Config entries for unknown guilds have been cleared.```')
@commands.command(
name='setconfig',
@ -97,7 +98,7 @@ class Debug(commands.Cog, name='Debug Commands'):
)
async def _setconfig(self, ctx:commands.Context):
setConfig(ctx.guild)
await ctx.reply(f'Config entry has been added for guild `{ctx.guild.name}`.')
await ctx.reply(f'```Config entry has been added for guild `{ctx.guild.name}`.```')
def setup(client):
client.add_cog(Debug(client))