This commit is contained in:
2021-07-26 21:14:50 +01:00
parent 7916b1fca6
commit 89a92586ff
3 changed files with 9 additions and 10 deletions

View File

@ -57,7 +57,7 @@ class Debug(commands.Cog, name='Debug Commands'):
async def _retrievecommands(self, ctx:commands.Context):
c = await utils.manage_commands.get_all_commands(
bot_id=self.client.user.id,
bot_token=os.getenv('TEST_3_TOKEN'),
bot_token=os.getenv('BOT_TOKEN'),
guild_id=ctx.guild.id
)
pprint(c)
@ -73,32 +73,32 @@ class Debug(commands.Cog, name='Debug Commands'):
if command == '--all' or command == '-a':
await utils.manage_commands.remove_all_commands(
bot_id=self.client.user.id,
bot_token=os.getenv('TEST_3_TOKEN'),
bot_token=os.getenv('BOT_TOKEN'),
guild_ids=[ ctx.guild.id ]
)
await ctx.reply(f'```All slash commands have been deleted for the guild `{ctx.guild.name}``.```')
elif command == '--global' or command == '-g':
await utils.manage_commands.remove_all_commands(
bot_id=self.client.user.id,
bot_token=os.getenv('TEST_3_TOKEN'),
bot_token=os.getenv('BOT_TOKEN'),
guild_ids=None
)
await utils.manage_commands.remove_all_commands(
bot_id=self.client.user.id,
bot_token=os.getenv('TEST_3_TOKEN'),
bot_token=os.getenv('BOT_TOKEN'),
guild_ids=[ int(g) for g in yaml_load(configFile)]
)
await ctx.reply('```All slash commands have been deleted globally.```')
else:
c = await utils.manage_commands.get_all_commands(
bot_id=self.client.user.id,
bot_token=os.getenv('TEST_3_TOKEN'),
bot_token=os.getenv('BOT_TOKEN'),
guild_id=ctx.guild.id
)
target = list(filter(lambda t: t['name'] == command, c))[0]['id']
await utils.manage_commands.remove_slash_command(
bot_id=self.client.user.id,
bot_token=os.getenv('TEST_3_TOKEN'),
bot_token=os.getenv('BOT_TOKEN'),
guild_id=ctx.guild.id,
cmd_id=target
)
@ -113,7 +113,7 @@ class Debug(commands.Cog, name='Debug Commands'):
async def _addCommand(self, ctx:commands.Context, command:str, key:str=''):
await utils.manage_commands.add_slash_command(
bot_id=self.client.user.id,
bot_token=os.getenv('TEST_3_TOKEN'),
bot_token=os.getenv('BOT_TOKEN'),
guild_id= None if key == '--global' or key == '-g' else ctx.guild.id,
cmd_name=command,
description='No Description'