async def on_reaction_add(reaction, user): """ When reaction is added, dispatch correct action """ if not should_ignore(bot, reaction.message.channel, user): emoji = get_emoji_from_reaction(reaction) # if a clearing emoji was clicked, remove all roles if is_clearing_emoji(emoji): await remove_all_roles(bot, user) # if emoji was not already listed, remove elif not is_listed_emoji(emoji): await bot.remove_reaction(reaction.message, reaction.emoji, user) else: role = get_role_from_reaction(reaction) await add_role(bot, user, role)
async def init(ctx): if not should_ignore(bot, ctx.message.channel, ctx.message.author): await commands.init(bot, ctx.message.channel, ctx.message.author)
async def help(ctx, *args): if not should_ignore(bot, ctx.message.channel, ctx.message.author): if len(args) == 0: await commands.help_cmd(bot, ctx) else: await commands.help_cmd(bot, ctx, args)
async def on_reaction_remove(reaction, user): """ When user removes reaction, remove role from user """ if not should_ignore(bot, reaction.message.channel, user): role = get_role_from_reaction(reaction) await remove_role(bot, user, role)