permission excepts

fight-fixes
bobloy 7 years ago
parent af00bb3a3a
commit e98c7b1694

@ -238,15 +238,19 @@ class CCRole:
if cmd['aroles']: if cmd['aroles']:
arole_list = [discord.utils.get(message.guild.roles, id=roleid) for roleid in cmd['aroles']] arole_list = [discord.utils.get(message.guild.roles, id=roleid) for roleid in cmd['aroles']]
# await self.bot.send_message(message.channel, "Adding: "+str([str(arole) for arole in arole_list])) # await self.bot.send_message(message.channel, "Adding: "+str([str(arole) for arole in arole_list]))
await target.add_roles(*arole_list) try:
await target.add_roles(*arole_list)
except discord.Forbidden:
await message.channel.send("Permission error: Unable to add roles")
await asyncio.sleep(1) await asyncio.sleep(1)
if cmd['rroles']: if cmd['rroles']:
rrole_list = [discord.utils.get(message.guild.roles, id=roleid) for roleid in cmd['rroles']] rrole_list = [discord.utils.get(message.guild.roles, id=roleid) for roleid in cmd['rroles']]
# await self.bot.send_message(message.channel, "Removing: "+str([str(rrole) for rrole in rrole_list])) # await self.bot.send_message(message.channel, "Removing: "+str([str(rrole) for rrole in rrole_list]))
await target.remove_roles(*rrole_list) try:
await target.remove_roles(*rrole_list)
except discord.Forbidden:
await message.channel.send("Permission error: Unable to remove roles")
await message.channel.send(cmd['text']) await message.channel.send(cmd['text'])
# {'text': text, 'aroles': arole_list, 'rroles': rrole_list, "proles", prole_list, "targeted": targeted} # {'text': text, 'aroles': arole_list, 'rroles': rrole_list, "proles", prole_list, "targeted": targeted}

Loading…
Cancel
Save