예제 #1
0
 async def get_tag(self, ctx):
     try:
         command = bot_tools.parse_command(ctx.message.content, 1)
     except ValueError:
         try:
             command = bot_tools.parse_command(ctx.message.content, 0)
         except:
             await ctx.send(embed=bot_tools.create_simple_embed(
                 ctx=ctx,
                 _title='Error',
                 _description=
                 f'{ctx.command.usage}. Use `!help {ctx.command.name}` for more details.'
             ))
             return
     if len(command) == 1:
         tags = [t['name'] for t in bot_db.get_all_tags()]
         await ctx.send(embed=bot_tools.create_list_embed(
             ctx=ctx,
             _title='Tags',
             _description='Here is a list of all the tags you can use.',
             _field_name='Tags',
             items=tags))
     else:
         [_, tag_name] = command
         tag = bot_db.get_tag(tag_name)
         if not bot_db.exists_tag(tag_name):
             await ctx.send(embed=bot_tools.create_simple_embed(
                 ctx=ctx,
                 _title='Error',
                 _description=f'The Tag `{tag_name}` does not exists.'))
         else:
             await ctx.send(tag['response'])
예제 #2
0
 async def user_info(self, ctx):
     try:
         command = bot_tools.parse_command(ctx.message.content, 1)
     except ValueError:
         try:
             command = bot_tools.parse_command(ctx.message.content, 0)
         except ValueError:
             await ctx.send(embed=bot_tools.create_simple_embed(
                 ctx=ctx,
                 _title='Error',
                 _description=
                 f'{ctx.command.usage}. Use `!help {ctx.command.name}` for more details.'
             ))
             return
     if len(command) == 1:
         member = ctx.guild.get_member(ctx.author.id)
         await ctx.send(embed=self.create_user_embed(ctx, member))
     else:
         [_, mention] = command
         user_id = 0
         try:
             user_id = int(
                 mention.replace('<@', '').replace('>',
                                                   '').replace('!', ''))
         except ValueError:
             await ctx.send(embed=bot_tools.create_simple_embed(
                 ctx=ctx, _title='Error', _description='Not a valid ping!'))
             return
         member = ctx.guild.get_member(user_id)
         if member == None:
             await ctx.send(embed=bot_tools.create_simple_embed(
                 ctx=ctx, _title='Error', _description='Not a valid ping!'))
         else:
             await ctx.send(embed=self.create_user_embed(ctx, member))
예제 #3
0
    async def clip(self, ctx):
        try:
            command = bot_tools.parse_command(ctx.message.content, 1)
        except ValueError:
            try:
                command = bot_tools.parse_command(ctx.message.content, 0)
            except ValueError:
                return await ctx.send(
                    'Usage: !clip <number> or just !clip for random clip.')

        clips_db = bot_db.get_all_clips()
        clips = [clip['url'] for clip in clips_db]

        if len(command) == 2:
            [_, num] = command
            number = int(num)
            if number <= len(clips):
                await ctx.send(f'Clip {number}/{len(clips)}: {clips[number-1]}'
                               )
            else:
                await ctx.send(
                    f'Chose from clips 1-{len(clips)} or no number for random clip.'
                )
        else:
            rnd = random.randint(0, len(clips) - 1)
            await ctx.send(f'Clip {rnd+1}/{len(clips)}: {clips[rnd]}')
예제 #4
0
 async def remove_admin(self, ctx):
     try:
         command = bot_tools.parse_command(ctx.message.content, 1)
     except ValueError:
         await ctx.send(embed=bot_tools.create_simple_embed(
             ctx=ctx,
             _title='Error',
             _description=
             f'{ctx.command.usage}. Use `!help {ctx.command.name}` for more details.'
         ))
         return
     [_, role_name] = command
     if not bot_db.exists_admin_role(role_name):
         await ctx.send(embed=bot_tools.create_simple_embed(
             ctx=ctx,
             _title='Error',
             _description=
             f'The role `{role_name}` is not on the list of admins.'))
         return
     else:
         bot_db.remove_admin_role(role_name)
         await ctx.send(embed=bot_tools.create_simple_embed(
             ctx=ctx,
             _title='Admin roles',
             _description=
             f'Successfully removed the role `{role_name}` from the list of admins.'
         ))
예제 #5
0
 async def add_admin(self, ctx):
     try:
         command = bot_tools.parse_command(ctx.message.content, 1)
     except ValueError:
         await ctx.send(embed=bot_tools.create_simple_embed(
             ctx=ctx,
             _title='Error',
             _description=
             f'{ctx.command.usage}. Use `!help {ctx.command.name}` for more details.'
         ))
         return
     [_, role_name] = command
     if bot_db.exists_admin_role(role_name):
         await ctx.send(embed=bot_tools.create_simple_embed(
             ctx=ctx,
             _title='Error',
             _description=f'The role `{role_name}` is already an admin.'))
         return
     else:
         if role_name in [roles.name for roles in ctx.guild.roles]:
             bot_db.add_admin_role(role_name)
             await ctx.send(embed=bot_tools.create_simple_embed(
                 ctx=ctx,
                 _title='Admin roles',
                 _description=
                 f'Successfully added the role `{role_name}` to the list of admins.'
             ))
         else:
             await ctx.send(embed=bot_tools.create_simple_embed(
                 ctx=ctx,
                 _title='Error',
                 _description=
                 f'The role `{role_name}` does not exist on this server.'))
예제 #6
0
async def get_tag(ctx):
    try: 
        command = bot_tools.parse_command(ctx.message.content, 1)
    except ValueError:
        await ctx.send('Error: Tags are all one word.')
        return
    [_, tag_name] = command
    tag = bot_db.get_tag(tag_name)
    if not bot_db.exists_tag(tag_name):
        await ctx.send(f'Error: The tag `{tag_name}` does not exist.')
    else:
        await ctx.send(tag['response'])
예제 #7
0
 async def get_tag(self, ctx):
     try:
         command = bot_tools.parse_command(ctx.message.content, 0)
     except ValueError:
         return
     [tag_name] = command
     tag = bot_db.get_tag(tag_name)
     if tag is None:
         utils.log_kv('[Bot#get_tag] Could not find tag, though we have a command', tag_name)
         return
     response = tag['response']
     await ctx.send(response)
예제 #8
0
    async def jisho_command(self, ctx):
        try:
            command = bot_tools.parse_command(ctx.message.content, 1)
        except ValueError:
            return await ctx.send('Usage: !j <keywords> [<result_number>]')

        [_, keywords] = command
        [keywords, result_number] = bot_tools.get_trailing_numbers(keywords)
        if result_number is None:
            message = self.get_jisho_results_message(keywords)
        else:
            message = self.get_jisho_results_message(keywords, result_number - 1)
        await ctx.send(message)
예제 #9
0
 async def add_vc_role(self, ctx):
     try:
         command = bot_tools.parse_command(ctx.message.content, 2)
     except:
         await ctx.send(embed=bot_tools.create_simple_embed(
             ctx=ctx,
             _title='Error',
             _description=
             f'{ctx.command.usage}. Use `!help {ctx.command.name}` for more details.'
         ))
         return
     [_, vc_id, tc_id] = command
     vc_id = int(vc_id)
     tc_id = int(tc_id)
     vc = ctx.guild.get_channel(vc_id)
     tc = ctx.guild.get_channel(tc_id)
     if bot_db.exists_voice_text(vc_id):
         await ctx.send(embed=bot_tools.create_simple_embed(
             ctx=ctx,
             _title='Error',
             _description=f'The role for `{vc.name}` is already set up.'))
         return
     else:
         if vc is None:
             await ctx.send(embed=bot_tools.create_simple_embed(
                 ctx=ctx,
                 _title='Error',
                 _description=
                 f'A voice channel with the provided id `{vc_id}` does not exist in this server!'
             ))
             return
         elif tc is None:
             await ctx.send(embed=bot_tools.create_simple_embed(
                 ctx=ctx,
                 _title='Error',
                 _description=
                 f'A text channel with the provided id `{tc_id}` does not exist in this server!'
             ))
             return
         else:
             # create role, set up perms, add db entry
             role = await ctx.guild.create_role(name=f'In {vc.name}')
             await tc.set_permissions(role, read_messages=True)
             bot_db.add_voice_text(vc_id, tc_id, role.id)
             await ctx.send(embed=bot_tools.create_simple_embed(
                 ctx=ctx,
                 _title='Voice role',
                 _description=
                 f'Successfully created the role `{role.name}` for users in `{vc.name}` to see `{tc.name}`.'
             ))
예제 #10
0
    async def add_data(self, ctx):
        if not bot_db.exists_admin(ctx.author.name):
            utils.log_body('[Bot#mod_command] Access denied to ' +
                           ctx.author.name)
            return
        try:
            command = bot_tools.parse_command(ctx.message.content, 2)
        except ValueError:
            return await ctx.send('Usage: add_data <name> <entry>')

        [_, name, entry] = command
        if entry.isdigit():
            entry = int(entry)
        bot_db.add_data(name, entry)
예제 #11
0
    async def eightball(self, ctx):
        try:
            command = bot_tools.parse_command(ctx.message.content, 1)
        except:
            await ctx.send(embed=bot_tools.create_simple_embed(
                ctx=ctx,
                _title='Error',
                _description=
                f'{ctx.command.usage}. Use `!help {ctx.command.name}` for more details.'
            ))
            return

        [_, message] = command

        await ctx.send(embed=create_eightball_embed(ctx.author.name, message))
예제 #12
0
async def remove_admin(ctx):
    if ctx.author.id == config.default_admin_id or bot_tools.is_admin(ctx.author):
        try:
            command = bot_tools.parse_command(ctx.message.content, 1)
        except ValueError:
            await ctx.send('Error: To add a role to admins, use !admin_add followed by the role name.')
            return
        [_, role_name] = command
        if not bot_db.exists_admin_role(role_name):
            await ctx.send(f'Error: The role `{role_name}` is not on the list of admins!')
            return
        else:
            bot_db.remove_admin_role(role_name)
            await ctx.send(f'Sucessfully removed the role `{role_name}` fromt the list of amdins!')
    else:
        await ctx.send('**You must be an admin to use this command!**')
예제 #13
0
async def add_tag(ctx):
    if bot_tools.is_admin(ctx.author):
        try:
            command = bot_tools.parse_command(ctx.message.content, 2)
        except ValueError:
            await ctx.send('Error: To create tags, use !t_add followed by the name followed by the messsage.')
            return
        [_, tag_name, tag_content] = command
        if bot_db.exists_tag(tag_name):
            await ctx.send(f'Error: The tag `{tag_name}` already exists.')
            return
        else:
            bot_db.add_tag(tag_name, tag_content)
            await ctx.send(f'Successfully added tag `{tag_name}`!')
    else:
        await ctx.send('Error: **You must be an admin to use this command!**')
예제 #14
0
async def remove_tag(ctx):
    if bot_tools.is_admin(ctx.author):
        try:
            command = bot_tools.parse_command(ctx.message.content, 1)
        except ValueError:
            await ctx.send('Error: To remove a tag, use !t_remove followed by just the name of tag.')
            return
        [_, tag_name] = command
        if not bot_db.exists_tag(tag_name):
            await ctx.send(f'Error: `{tag_name}` does not exists!')
            return
        else:
            bot_db.remove_tag(tag_name)
            await ctx.send(f'Sucessfully removed tag `{tag_name}`.')
    else:
        await ctx.send('Erorr: **You must be an admin to use this command!**')
예제 #15
0
    async def mod_command(self, ctx):
        if not bot_tools.is_superadmin(ctx.author.name):
            utils.log_body('[Bot#mod_command] Access denied to ' + ctx.author.name)
            return
        try:
            command = bot_tools.parse_command(ctx.message.content, 1)
        except ValueError:
            return await ctx.send('Usage: mod <name>')

        [_, mod_name] = command
        utils.log_kv('Modding', mod_name)

        if bot_db.is_mod(mod_name):
            await ctx.send(f'{mod_name} is already a mod.')
        else:
            bot_db.add_mod(mod_name)
            await ctx.send(f'Modded {mod_name}.')
예제 #16
0
    async def remove_clip(self, ctx):
        if not bot_db.is_mod(ctx.author.name):
            utils.log_body('[Bot#remove_clip_command] Access denied to ' +
                           ctx.author.name)
            return
        try:
            command = bot_tools.parse_command(ctx.message.content, 1)
        except ValueError:
            return await ctx.send('Usage: !remove_clip <url>.')

        [_, url] = command

        if bot_db.exists_clip(url):
            bot_db.remove_clip(url)
            await ctx.send('Removed clip!')
        else:
            await ctx.send('Clip does not exists in db!')
예제 #17
0
    async def demod_command(self, ctx):
        if not bot_tools.is_superadmin(ctx.author.name):
            utils.log_body('[Bot#demod_command] Access denied to ' + ctx.author.name)
            return
        try:
            command = bot_tools.parse_command(ctx.message.content, 1)
        except ValueError:
            return await ctx.send('Usage: demod <name>')

        [_, user_name] = command
        utils.log_kv('Demodding', user_name)

        if bot_db.is_mod(user_name):
            bot_db.remove_mod(user_name)
            await ctx.send(f'Demodded {user_name}.')
        else:
            await ctx.send(f'{user_name} is not a mod.')
예제 #18
0
    async def purge_role(self, ctx):
        try:
            command = bot_tools.parse_command(ctx.message.content, 1)
        except ValueError:
            await ctx.send(embed=bot_tools.create_simple_embed(
                ctx=ctx,
                _title='Error',
                _description=
                f'{ctx.command.usage}. Use `!help {ctx.command.name}` for more details.'
            ))
            return

        [_, roles] = command
        roles = roles.split()
        role_ids = [
            int(role.replace('<@&', '').replace('>', '')) for role in roles
        ]
        invalid_roles = []
        valid_roles = []
        for role in role_ids:
            role_obj = discord.utils.get(ctx.guild.roles, id=role)
            if role_obj is None:
                invalid_roles.append(role)
            else:
                valid_roles.append(role_obj)

        invalid_roles_string = ' '.join(invalid_roles)
        if len(invalid_roles) > 0:
            await ctx.send(embed=bot_tools.create_simple_embed(
                ctx=ctx,
                _title='Error',
                _description=
                f'{invalid_roles_string} is/are not valid roles on this server.'
            ))
            return

        for user in ctx.guild.members:
            for role in valid_roles:
                if role in user.roles:
                    await user.remove_roles(role, reason=None, atomic=True)

        roles_string = ' '.join(roles)
        await ctx.send(embed=bot_tools.create_simple_embed(
            ctx=ctx,
            _title='Purge Role',
            _description=f'Successfully purged the role(s) {roles_string}.'))
예제 #19
0
    async def add_tag_command(self, ctx):
        if not bot_db.is_mod(ctx.author.name):
            utils.log_body('[Bot#add_tag_command] Access denied to ' + ctx.author.name)
            return
        try:
            command = bot_tools.parse_command(ctx.message.content, 2)
        except ValueError:
            return await ctx.send('Usage: add_tag <tag_name> <tag_response>')

        [_, tag_name, tag_response] = command
        utils.log_kv('Adding tag', [tag_name, tag_response])

        if bot_db.exists_tag(tag_name):
            await ctx.send(f'Tag {tag_name} already exists.')
        else:
            bot_db.add_tag(tag_name, tag_response)
            self.add_command(Command(name=tag_name, func=self.get_tag, aliases=[], instance=None))
            await ctx.send(f'Added tag {tag_name}.')
예제 #20
0
async def add_admin(ctx):
    if ctx.author.id == config.default_admin_id or bot_tools.is_admin(ctx.author):
        try:
            command = bot_tools.parse_command(ctx.message.content, 1)
        except ValueError:
            await ctx.send('Error: To add a role to admins, use !admin_add followed by the role name.')
            return
        [_, role_name] = command
        if bot_db.exists_admin_role(role_name):
            await ctx.send(f'Error: The role `{role_name}` is alreayd an admin.`')
            return
        else:
            if role_name in [roles.name for roles in ctx.guild.roles]:
                bot_db.add_admin_role(role_name)
                await ctx.send(f'Successfully added the role `{role_name}` to the list of admins.')
            else:
                await ctx.send(f'Error: The role `{role_name}` does not exists on this server!')
    else:
        await ctx.send('**You must be an admin to use this command!**')
예제 #21
0
    async def remove_tag_command(self, ctx):
        if not bot_db.is_mod(ctx.author.name):
            utils.log_body('[Bot#remove_tag_command] Access denied to ' + ctx.author.name)
            return
        try:
            command = bot_tools.parse_command(ctx.message.content, 1)
        except ValueError:
            return await ctx.send('Usage: remove_tag <tag_name>')

        [_, tag_name] = command
        utils.log_kv('Removing tag', tag_name)

        if bot_db.exists_tag(tag_name):
            bot_db.remove_tag(tag_name)

            async def dummy_func():
                pass

            self.remove_command(Command(name=tag_name, func=dummy_func))

            await ctx.send(f'Removed tag {tag_name}.')
        else:
            await ctx.send(f'Tag {tag_name} does not exist.')
예제 #22
0
 async def add_tag(self, ctx):
     try:
         command = bot_tools.parse_command(ctx.message.content, 2)
     except ValueError:
         await ctx.send(embed=bot_tools.create_simple_embed(
             ctx=ctx,
             _title='Error',
             _description=
             f'{ctx.command.usage}. Use `!help {ctx.command.name}` for more details.'
         ))
         return
     [_, tag_name, tag_content] = command
     if bot_db.exists_tag(tag_name):
         await ctx.send(embed=bot_tools.create_simple_embed(
             ctx=ctx,
             _title='Error',
             _description=f'The tag `{tag_name}` already exists.'))
         return
     else:
         bot_db.add_tag(tag_name, tag_content)
         await ctx.send(embed=bot_tools.create_simple_embed(
             ctx=ctx,
             _title='Tag',
             _description=f'Successfully added tag `{tag_name}`!'))
예제 #23
0
    async def add_clip(self, ctx):
        if not bot_db.is_mod(ctx.author.name):
            utils.log_body('[Bot#add_clip_command] Access denied to ' +
                           ctx.author.name)
            return
        try:
            command = bot_tools.parse_command(ctx.message.content, 1)
        except ValueError:
            return await ctx.send('Usage: !add_clip <url>.')

        [_, url] = command

        clips_db = bot_db.get_all_clips()
        clips = [clip['url'] for clip in clips_db]

        utils.log_kv('Adding Clip', [url])

        if bot_db.exists_clip(url):
            index = clips.index(url)
            await ctx.send(
                f'That clip already exists. Clip {index+1}/{len(clips)}.')
        else:
            bot_db.add_clip(url)
            await ctx.send(f'Added Clip {len(clips)+1}.')
예제 #24
0
 async def remove_tag(self, ctx):
     try:
         command = bot_tools.parse_command(ctx.message.content, 1)
     except ValueError:
         await ctx.send(embed=bot_tools.create_simple_embed(
             ctx=ctx,
             _title='Error',
             _description=
             f'{ctx.command.usage}. Use `!help {ctx.command.name}` for more details.'
         ))
         return
     [_, tag_name] = command
     if not bot_db.exists_tag(tag_name):
         await ctx.send(embed=bot_tools.create_simple_embed(
             ctx=ctx,
             _title='Error',
             _description=f'`{tag_name}` does not exists!'))
         return
     else:
         bot_db.remove_tag(tag_name)
         await ctx.send(embed=bot_tools.create_simple_embed(
             ctx=ctx,
             _title='Tag',
             _description=f'Successfully removed tag `{tag_name}`'))
예제 #25
0
    async def remove_vc_role(self, ctx):
        try:
            command = bot_tools.parse_command(ctx.message.content, 1)
        except:
            await ctx.send(embed=bot_tools.create_simple_embed(
                ctx=ctx,
                _title='Error',
                _description=
                f'{ctx.command.usage}. Use `!help {ctx.command.name}` for more details.'
            ))
            return
        [_, vc_id] = command
        vc_id = int(vc_id)
        vc = ctx.guild.get_channel(vc_id)

        if bot_db.exists_voice_text(vc_id):
            entry = bot_db.get_voice_text(vc_id)
            role = ctx.guild.get_role(entry['r_id'])
            role_name = role.name
            tc = ctx.guild.get_channel(entry['tc_id'])
            await role.delete()
            bot_db.remove_voic_text(vc_id)
            await ctx.send(embed=bot_tools.create_simple_embed(
                ctx=ctx,
                _title='Voice role',
                _description=
                f'Successfully removed the voice role `{role_name}` from the voice/text pair `{vc.name}`/`{tc.name}`.'
            ))
            return
        else:
            await ctx.send(embed=bot_tools.create_simple_embed(
                ctx=ctx,
                _title='Error',
                _description=
                f'The specified voice chat id `{vc_id}` does not correspond to any role currently associated with a voice/text channel pair.'
            ))
예제 #26
0
    async def help_message(self, ctx):
        cogs = [
            cog for cog in self.bot.cogs.values() if cog.description[0] != '0'
        ]
        cogs = sorted(cogs, key=lambda x: x.qualified_name)
        other_commands = [
            command for command in self.bot.commands if command.cog is None
        ]
        try:
            command = bot_tools.parse_command(ctx.message.content, 1)
        except ValueError:
            try:
                command = bot_tools.parse_command(ctx.message.content, 0)
            except ValueError:
                return
            right_arrow = '\U000027A1'
            left_arrow = '\U00002B05'

            embeds = await create_help_embeds(ctx, cogs, other_commands)
            current = 0

            help_message = await ctx.send(embed=embeds[current])
            await help_message.add_reaction(left_arrow)
            await help_message.add_reaction(right_arrow)

            def check(reaction, user):
                return user == ctx.message.author and user != self.bot.user and (
                    str(reaction.emoji) == right_arrow
                    or left_arrow and reaction.message == help_message)

            while (True):
                try:
                    reaction, user = await self.bot.wait_for('reaction_add',
                                                             timeout=600.0,
                                                             check=check)
                except asyncio.TimeoutError:
                    await help_message.remove_reaction(left_arrow,
                                                       help_message.author)
                    await help_message.remove_reaction(right_arrow,
                                                       help_message.author)
                    return
                if str(reaction.emoji) == right_arrow:
                    if current < len(embeds) - 1:
                        current += 1
                        await help_message.edit(embed=embeds[current])
                    await reaction.remove(user)
                elif str(reaction.emoji) == left_arrow:
                    if current > 0:
                        current -= 1
                        await help_message.edit(embed=embeds[current])
                    await reaction.remove(user)

        [_, command_name] = command
        command_name = command_name.replace('!', '').replace('`', '')
        requested_command = discord.utils.get(self.bot.commands,
                                              name=command_name)
        if requested_command is None:
            for command in self.bot.commands:
                if command_name in command.aliases:
                    requested_command = command
            if requested_command is None:
                await ctx.send(embed=bot_tools.create_simple_embed(
                    ctx, 'Error',
                    f'Not a recoginzed command. {ctx.command.usage}'))
                return
        await ctx.send(
            embed=create_commmand_help_embed(ctx, requested_command))
예제 #27
0
    async def set_role_message(self, ctx):
        try:
            command = bot_tools.parse_command(ctx.message.content, 2)
        except ValueError:
            await ctx.send(embed=bot_tools.create_simple_embed(
                ctx=ctx,
                _title='Error',
                _description=
                f'{ctx.command.usage}. Use `!help {ctx.command.name}` for more details.'
            ))
            return

        [_, ch_id, msg_id] = command
        try:
            ch_id = int(ch_id)
            msg_id = int(msg_id)
        except:
            await ctx.send(embed=bot_tools.create_simple_embed(
                ctx=ctx, _title='Error', _description='IDs must be numbers!'))
            return
        data = bot_db.get_role_data()
        if data is None:
            channel = discord.utils.get(ctx.guild.text_channels, id=ch_id)
            if channel is None:
                await ctx.send(embed=bot_tools.create_simple_embed(
                    ctx=ctx,
                    _title='Error',
                    _description='Not a valid channel id!'))
                return
            message = discord.utils.get(await channel.history().flatten(),
                                        id=msg_id)
            if message is None:
                await ctx.send(embed=bot_tools.create_simple_embed(
                    ctx=ctx,
                    _title='Error',
                    _description='Not a valid message id!'))
                return
            bot_db.fill_role_data(msg_id, ch_id)
            await ctx.send(embed=bot_tools.create_simple_embed(
                ctx=ctx,
                _title='Reaction Role Message',
                _description=
                f'Successfully set reaction role channel to <#{channel.id}> and message to {message.jump_url} !'
            ))
        else:
            channel = discord.utils.get(ctx.guild.text_channels,
                                        id=data[0]['channel_id'])
            message = discord.utils.get(await channel.history().flatten(),
                                        id=data[0]['message_id'])

            try:
                response = await ctx.send(embed=bot_tools.create_simple_embed(
                    ctx=ctx,
                    _title='Reaction Role Message',
                    _description=
                    f'The current reaction role channel is <#{channel.id}> and the message {message.jump_url} ! Are you sure you want to change it?'
                ))
            except:
                response = await ctx.send(embed=bot_tools.create_simple_embed(
                    ctx=ctx,
                    _title='Reaction Role Message',
                    _description=
                    f'The current reaction role channel is <#{channel.id}> but the message cannot be found. It was most likely deleted. Do you want to overwrite?'
                ))
            check_mark = '\U00002714'
            cross_mark = '\U0000274C'
            await response.add_reaction(check_mark)
            await response.add_reaction(cross_mark)

            def check(reaction, user):
                return user == ctx.message.author and user != self.bot.user and (
                    str(reaction.emoji) == check_mark or cross_mark)

            try:
                reaction, user = await self.bot.wait_for('reaction_add',
                                                         timeout=60.0,
                                                         check=check)
            except asyncio.TimeoutError:
                await ctx.send('Timed out! Try again!')
                return
            else:
                if str(reaction.emoji) == check_mark:
                    channel = discord.utils.get(ctx.guild.text_channels,
                                                id=ch_id)
                    if channel is None:
                        await ctx.send(embed=bot_tools.create_simple_embed(
                            ctx=ctx,
                            _title='Error',
                            _description='Not a valid channel id!'))
                        return
                    message = discord.utils.get(await
                                                channel.history().flatten(),
                                                id=msg_id)
                    if message is None:
                        await ctx.send(embed=bot_tools.create_simple_embed(
                            ctx=ctx,
                            _title='Error',
                            _description='Not a valid message id!'))
                        return
                    bot_db.change_role_data(msg_id, ch_id)
                    await ctx.send(embed=bot_tools.create_simple_embed(
                        ctx=ctx,
                        _title='Reaction Role Message',
                        _description=
                        f'Successfully set reaction role channel to <#{channel.id}> and message to {message.jump_url} !'
                    ))
                elif str(reaction.emoji) == cross_mark:
                    await ctx.send('Cancelled!')
                    return

        message_words = message.content.split()

        filtered_message = [
            entry.replace('<', '').replace('>', '').replace('@&', '')
            for entry in message_words if '<' in entry
        ]

        emote_dict = {}

        for emote, role in bot_tools.grouped(filtered_message, 2):
            emote_dict.update({emote: int(role)})

        bot_db.update_role_data(emote_dict)

        for emote, role in emote_dict.items():
            emote_id = emote.split(':')[2]
            emoji = self.bot.get_emoji(int(emote_id))
            await message.add_reaction(emoji)