From 14a8222e40d4bc4dd9e61083ab0be363b16d4c63 Mon Sep 17 00:00:00 2001 From: phxntxm Date: Fri, 8 Jul 2016 20:59:10 -0500 Subject: [PATCH] Added class descriptions for cogs; created listboops command --- cogs/core.py | 1 + cogs/interaction.py | 1 + cogs/mod.py | 1 + cogs/owner.py | 1 + cogs/stats.py | 19 +++++++++++++++++++ 5 files changed, 23 insertions(+) diff --git a/cogs/core.py b/cogs/core.py index 20eeed3..424cd9a 100644 --- a/cogs/core.py +++ b/cogs/core.py @@ -9,6 +9,7 @@ import random class Core: + """Core commands, these are the not 'complicated' commands.""" def __init__(self, bot): self.bot = bot diff --git a/cogs/interaction.py b/cogs/interaction.py index a91cac0..cc325b2 100644 --- a/cogs/interaction.py +++ b/cogs/interaction.py @@ -55,6 +55,7 @@ def updateBattleRecords(winner, loser): class Interaction: + """Commands that interact with another user""" def __init__(self, bot): self.bot = bot diff --git a/cogs/mod.py b/cogs/mod.py index 0c11d26..4501cb7 100644 --- a/cogs/mod.py +++ b/cogs/mod.py @@ -3,6 +3,7 @@ from .utils import checks class Mod: + """Commands that can be used by a or an admin, depending on the command""" def __init__(self, bot): self.bot = bot diff --git a/cogs/owner.py b/cogs/owner.py index 11cc826..ac2c245 100644 --- a/cogs/owner.py +++ b/cogs/owner.py @@ -11,6 +11,7 @@ multi = re.compile(r'```(.*?)```', re.DOTALL) class Owner: + """Commands that can only be used by Phantom, bot management commands""" def __init__(self, bot): self.bot = bot diff --git a/cogs/stats.py b/cogs/stats.py index 12019e6..d3dfd13 100644 --- a/cogs/stats.py +++ b/cogs/stats.py @@ -5,6 +5,7 @@ import re class Stats: + """Leaderboard/stats related commands""" def __init__(self, bot): self.bot = bot @@ -26,6 +27,24 @@ class Stats: fmt = 'An error occurred while processing this request: ```py\n{}: {}\n```' await self.bot.say(fmt.format(type(e).__name__, e)) + @commands.command(pass_context=True, no_pm=True) + async def listboops(self, ctx): + """Lists all the users you have booped and the amount of times""" + cursor = config.connection.cursor() + cursor.execute('use {}'.format(config.db_boops)) + sql = "select * from `{}`".format(ctx.message.author.id) + cursor.execute(sql) + result = cursor.fetchall() + if result is None: + await self.bot.say("You have not booped anyone!") + return + output = "You have booped:" + for r in result: + member = find(lambda m: m.id == r['id'], self.bot.get_all_members()) + amount = r['amount'] + output += "\n{0.name}: {1} times".format(member,amount) + await self.bot.say("```{}```".format(output)) + @commands.command(pass_context=True, no_pm=True) async def mostwins(self, ctx): """Prints a 'leaderboard' of everyone in the server's battling record"""