def cmd_ignore(self, message, author, server, option, new_id, reason=None):
"""
Usage: {command_prefix}ignore [ + | - | add | remove ] <channel ID> ["reason"]
Adds or removes the channel ID to the list of ignored channels when outputting to the server log
"""
if await self.has_roles(message.channel, author, server, command='ignore'):
if option not in ['+', '-', 'add', 'remove']:
raise CommandError('Invalid option "%s" specified, use +, -, add, or remove' % option)
try:
channel = discord.utils.get(server.channels, id=new_id)
if not channel:
int('this')
except:
raise CommandError('Invalid Channel: {}'.format(new_id))
if option in ['+', 'add']:
self.server_index[server.id][12].append(channel.id)
else:
try:
self.server_index[server.id][12].remove(channel.id)
except ValueError:
raise CommandError('No such channel in ignore list : {}'.format(new_id))
await self.write_to_modlog(message, author, server, reason)
评论列表
文章目录