Ejemplo n.º 1
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)
Ejemplo n.º 2
0
 async def event_message(self, message):
     utils.log_kv('[Bot#event_message] New message', message.content)
     if 'bruh' in message.content.lower(
     ) and not message.author.name == config.bot_nick and not 'reset_bruh' in message.content:
         print('bruh found')
         if bot_db.exists_data('bruhs'):
             bot_db.increment_bruhs()
             bruhs = bot_db.get_data('bruhs')
             await message.channel.send(f'Bruh Counter: {bruhs[0]["bruhs"]}'
                                        )
         else:
             print('No data')
     await self.handle_commands(message)
Ejemplo n.º 3
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.')
Ejemplo n.º 4
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}.')
Ejemplo n.º 5
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}.')
Ejemplo n.º 6
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.')
Ejemplo n.º 7
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}.')
Ejemplo n.º 8
0
 async def event_ready(self):
     utils.log_kv('[Bot#event_ready] Ready with username', self.nick)
     utils.log_kv('Admins: ', bot_db.get_all_admins())
Ejemplo n.º 9
0
 async def event_message(self, message):
     utils.log_kv('[Bot#event_message] New message', message.content)
     await self.handle_commands(message)
Ejemplo n.º 10
0
 async def event_ready(self):
     utils.log_kv('[Bot#event_ready] Ready with username', self.nick)
     utils.log_kv('Tags', bot_db.get_all_tags())
     utils.log_kv('Mods', bot_db.get_all_mods())
     utils.log_kv('Superadmins', config.superadmins)