async def res_bruh(self, ctx): if not bot_db.exists_admin(ctx.author.name): utils.log_body('[Bot#mod_command] Access denied to ' + ctx.author.name) return if bot_db.exists_data('bruhs'): bot_db.resetbruh() await ctx.send('Reset Bruh Coutner to 0') else: await ctx.send('No Bruh-coutner initialized')
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)
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.')
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}.')
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!')
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}.')
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.')
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}.')