1
0
Fork 0
mirror of synced 2024-05-06 21:52:30 +12:00

Added class descriptions for cogs; created listboops command

This commit is contained in:
phxntxm 2016-07-08 20:59:10 -05:00
parent 87238709df
commit 14a8222e40
5 changed files with 23 additions and 0 deletions

View file

@ -9,6 +9,7 @@ import random
class Core:
"""Core commands, these are the not 'complicated' commands."""
def __init__(self, bot):
self.bot = bot

View file

@ -55,6 +55,7 @@ def updateBattleRecords(winner, loser):
class Interaction:
"""Commands that interact with another user"""
def __init__(self, bot):
self.bot = bot

View file

@ -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

View file

@ -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

View file

@ -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"""