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

View File

@ -1,5 +1,4 @@
FROM python:3.9.6-alpine FROM python:3.9.6-buster
COPY . /usr/src/app
WORKDIR /usr/src/app WORKDIR /usr/src/app
RUN pip install --upgrade pip RUN pip install --upgrade pip
RUN pip install -r requirements.txt RUN pip install -r requirements.txt

View File

@ -55,7 +55,7 @@ class EditMembership(commands.Cog, name='Edit Membership'):
if role.id in conf[str(ctx.guild.id)]['membership']: if role.id in conf[str(ctx.guild.id)]['membership']:
conf[str(ctx.guild.id)]['membership'].remove(role.id) conf[str(ctx.guild.id)]['membership'].remove(role.id)
yaml_dump(conf, configFile) yaml_dump(conf, configFile)
await ctx.send(f'```Membership type {role.name} has been deleted for the guild `{ctx.guild.name}`.```') await ctx.send(f'```Membership type {role.name} has been deleted for the guild `{ctx.guild.name}`.```', hidden=True)
await role.delete(reason=f'`/config membership remove` command issued by `{ctx.author.display_name}`.') await role.delete(reason=f'`/config membership remove` command issued by `{ctx.author.display_name}`.')
if not any([x['membership'] for x in yaml_load(configFile).values()]): if not any([x['membership'] for x in yaml_load(configFile).values()]):
unloadCog(f'./{cogsDir}/slashcommands/secondary/edit_membership.py') unloadCog(f'./{cogsDir}/slashcommands/secondary/edit_membership.py')

View File

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