2016-09-30 06:29:57 +13:00
|
|
|
import discord
|
2016-07-09 13:27:19 +12:00
|
|
|
from discord.ext import commands
|
2016-09-30 06:29:57 +13:00
|
|
|
|
2017-02-13 10:30:50 +13:00
|
|
|
from . import utils
|
2016-09-30 06:29:57 +13:00
|
|
|
|
|
|
|
import re
|
2016-07-09 13:27:19 +12:00
|
|
|
|
2016-09-29 12:39:34 +13:00
|
|
|
|
|
|
|
class Stats:
|
|
|
|
"""Leaderboard/stats related commands"""
|
|
|
|
|
|
|
|
def __init__(self, bot):
|
|
|
|
self.bot = bot
|
|
|
|
|
2017-03-08 11:35:30 +13:00
|
|
|
@commands.command(no_pm=True)
|
2017-02-13 10:30:50 +13:00
|
|
|
@utils.custom_perms(send_messages=True)
|
2016-11-21 13:54:07 +13:00
|
|
|
async def serverinfo(self, ctx):
|
2016-11-29 17:55:55 +13:00
|
|
|
"""Provides information about the server
|
|
|
|
|
|
|
|
EXAMPLE: !serverinfo
|
|
|
|
RESULT: Information about your server!"""
|
2017-03-08 11:35:30 +13:00
|
|
|
server = ctx.message.guild
|
2016-11-21 13:54:07 +13:00
|
|
|
# Create our embed that we'll use for the information
|
|
|
|
embed = discord.Embed(title=server.name, description="Created on: {}".format(server.created_at.date()))
|
|
|
|
|
|
|
|
# Make sure we only set the icon url if it has been set
|
|
|
|
if server.icon_url != "":
|
2016-11-21 13:56:16 +13:00
|
|
|
embed.set_thumbnail(url=server.icon_url)
|
2016-11-21 13:54:07 +13:00
|
|
|
|
|
|
|
# Add our fields, these are self-explanatory
|
2016-11-21 13:56:16 +13:00
|
|
|
embed.add_field(name='Region', value=str(server.region))
|
2016-11-21 13:54:07 +13:00
|
|
|
embed.add_field(name='Total Emojis', value=len(server.emojis))
|
|
|
|
|
|
|
|
# Get the amount of online members
|
2016-11-21 13:59:40 +13:00
|
|
|
online_members = [m for m in server.members if str(m.status) == 'online']
|
2016-11-21 13:54:07 +13:00
|
|
|
embed.add_field(name='Total members', value='{}/{}'.format(len(online_members), server.member_count))
|
|
|
|
embed.add_field(name='Roles', value=len(server.roles))
|
|
|
|
|
|
|
|
# Split channels into voice and text channels
|
2017-03-28 07:57:35 +13:00
|
|
|
voice_channels = [c for c in server.channels if type(c) is discord.VoiceChannel]
|
|
|
|
text_channels = [c for c in server.channels if type(c) is discord.TextChannel]
|
2016-11-21 13:54:07 +13:00
|
|
|
embed.add_field(name='Channels', value='{} text, {} voice'.format(len(text_channels), len(voice_channels)))
|
|
|
|
embed.add_field(name='Owner', value=server.owner.display_name)
|
|
|
|
|
2017-03-08 11:35:30 +13:00
|
|
|
await ctx.send(embed=embed)
|
2016-11-21 13:54:07 +13:00
|
|
|
|
2017-03-08 11:35:30 +13:00
|
|
|
@commands.group(no_pm=True, pass_context=False)
|
2017-02-13 10:30:50 +13:00
|
|
|
@utils.custom_perms(send_messages=True)
|
2016-09-26 16:58:33 +13:00
|
|
|
async def command(self):
|
|
|
|
pass
|
|
|
|
|
2017-03-08 11:35:30 +13:00
|
|
|
@command.command(no_pm=True, name="stats")
|
2017-02-13 10:30:50 +13:00
|
|
|
@utils.custom_perms(send_messages=True)
|
2016-09-26 16:58:33 +13:00
|
|
|
async def command_stats(self, ctx, *, command):
|
2016-11-29 17:55:55 +13:00
|
|
|
"""This command can be used to view some usage stats about a specific command
|
|
|
|
|
|
|
|
EXAMPLE: !command stats play
|
|
|
|
RESULT: The realization that this is the only reason people use me ;-;"""
|
2017-03-20 12:04:52 +13:00
|
|
|
await ctx.message.channel.trigger_typing()
|
|
|
|
|
2017-03-08 11:35:30 +13:00
|
|
|
cmd = self.bot.get_command(command)
|
2016-09-26 16:58:33 +13:00
|
|
|
if cmd is None:
|
2017-03-08 11:35:30 +13:00
|
|
|
await ctx.send("`{}` is not a valid command".format(command))
|
2017-01-25 09:45:34 +13:00
|
|
|
return
|
2016-09-26 16:58:33 +13:00
|
|
|
|
2017-03-08 17:28:30 +13:00
|
|
|
command_stats = await utils.get_content('command_usage', cmd.qualified_name)
|
2017-03-08 19:43:40 +13:00
|
|
|
if command_stats is None:
|
2017-03-08 11:35:30 +13:00
|
|
|
await ctx.send("That command has never been used! You know I worked hard on that! :c")
|
2016-09-30 06:29:57 +13:00
|
|
|
return
|
|
|
|
|
|
|
|
total_usage = command_stats['total_usage']
|
2017-03-08 19:51:17 +13:00
|
|
|
member_usage = command_stats['member_usage'].get(str(ctx.message.author.id), 0)
|
|
|
|
server_usage = command_stats['server_usage'].get(str(ctx.message.guild.id), 0)
|
2016-09-30 06:29:57 +13:00
|
|
|
|
2016-10-16 18:27:07 +13:00
|
|
|
try:
|
2016-10-31 10:54:58 +13:00
|
|
|
data = [("Command Name", cmd.qualified_name),
|
2016-11-02 08:34:05 +13:00
|
|
|
("Total Usage", total_usage),
|
|
|
|
("Your Usage", member_usage),
|
|
|
|
("This Server's Usage", server_usage)]
|
2017-02-13 10:45:11 +13:00
|
|
|
banner = await utils.create_banner(ctx.message.author, "Command Stats", data)
|
2017-03-08 11:35:30 +13:00
|
|
|
await ctx.send(file=banner)
|
2016-10-16 18:27:07 +13:00
|
|
|
except (FileNotFoundError, discord.Forbidden):
|
2016-10-02 13:41:41 +13:00
|
|
|
fmt = "The command {} has been used a total of {} times\n" \
|
|
|
|
"{} times on this server\n" \
|
|
|
|
"It has been ran by you, {}, {} times".format(cmd.qualified_name, total_usage, server_usage,
|
|
|
|
ctx.message.author.display_name, member_usage)
|
2016-09-30 06:29:57 +13:00
|
|
|
|
2017-03-08 11:35:30 +13:00
|
|
|
await ctx.send(fmt)
|
2016-09-30 06:29:57 +13:00
|
|
|
|
2017-03-08 11:35:30 +13:00
|
|
|
@command.command(no_pm=True, name="leaderboard")
|
2017-02-13 10:30:50 +13:00
|
|
|
@utils.custom_perms(send_messages=True)
|
2016-09-30 06:33:54 +13:00
|
|
|
async def command_leaderboard(self, ctx, option="server"):
|
2016-09-30 06:29:57 +13:00
|
|
|
"""This command can be used to print a leaderboard of commands
|
|
|
|
Provide 'server' to print a leaderboard for this server
|
2016-11-29 17:55:55 +13:00
|
|
|
Provide 'me' to print a leaderboard for your own usage
|
|
|
|
|
|
|
|
EXAMPLE: !command leaderboard me
|
|
|
|
RESULT: The realization of how little of a life you have"""
|
2017-03-20 12:04:52 +13:00
|
|
|
await ctx.message.channel.trigger_typing()
|
|
|
|
|
2016-09-30 06:29:57 +13:00
|
|
|
if re.search('(author|me)', option):
|
|
|
|
author = ctx.message.author
|
|
|
|
# First lets get all the command usage
|
2017-02-13 10:30:50 +13:00
|
|
|
command_stats = await utils.get_content('command_usage')
|
2016-09-30 06:29:57 +13:00
|
|
|
# Now use a dictionary comprehension to get just the command name, and usage
|
|
|
|
# Based on the author's usage of the command
|
2017-03-08 19:51:17 +13:00
|
|
|
stats = {data['command']: data['member_usage'].get(str(author.id)) for data in command_stats
|
|
|
|
if data['member_usage'].get(str(author.id), 0) > 0}
|
2016-09-30 06:29:57 +13:00
|
|
|
# Now sort it by the amount of times used
|
|
|
|
sorted_stats = sorted(stats.items(), key=lambda x: x[1], reverse=True)
|
|
|
|
|
|
|
|
# Create a string, each command on it's own line, based on the top 5 used commands
|
|
|
|
# I'm letting it use the length of the sorted_stats[:5]
|
|
|
|
# As this can include, for example, all 3 if there are only 3 entries
|
2016-10-16 18:27:07 +13:00
|
|
|
try:
|
2016-10-31 10:54:58 +13:00
|
|
|
top_5 = [(data[0], data[1]) for data in sorted_stats[:5]]
|
2017-02-13 10:45:11 +13:00
|
|
|
banner = await utils.create_banner(ctx.message.author, "Your command usage", top_5)
|
2017-03-08 11:35:30 +13:00
|
|
|
await ctx.send(file=banner)
|
2016-10-16 18:27:07 +13:00
|
|
|
except (FileNotFoundError, discord.Forbidden):
|
2016-10-02 13:41:41 +13:00
|
|
|
top_5 = "\n".join("{}: {}".format(data[0], data[1]) for data in sorted_stats[:5])
|
2017-03-08 11:35:30 +13:00
|
|
|
await ctx.send(
|
2016-11-02 08:34:05 +13:00
|
|
|
"Your top {} most used commands are:\n```\n{}```".format(len(sorted_stats[:5]), top_5))
|
2016-09-30 06:29:57 +13:00
|
|
|
elif re.search('server', option):
|
|
|
|
# This is exactly the same as above, except server usage instead of member usage
|
2017-03-08 11:35:30 +13:00
|
|
|
server = ctx.message.guild
|
2017-02-13 10:30:50 +13:00
|
|
|
command_stats = await utils.get_content('command_usage')
|
2017-03-08 19:51:17 +13:00
|
|
|
stats = {data['command']: data['server_usage'].get(str(server.id)) for data in command_stats
|
|
|
|
if data['server_usage'].get(str(server.id), 0) > 0}
|
2016-09-30 06:29:57 +13:00
|
|
|
sorted_stats = sorted(stats.items(), key=lambda x: x[1], reverse=True)
|
2017-03-09 08:36:11 +13:00
|
|
|
try:
|
|
|
|
top_5 = [(data[0], data[1]) for data in sorted_stats[:5]]
|
|
|
|
banner = await utils.create_banner(ctx.message.author, "Server command usage", top_5)
|
|
|
|
await ctx.send(file=banner)
|
|
|
|
except (FileNotFoundError, discord.Forbidden):
|
|
|
|
top_5 = "\n".join("{}: {}".format(data[0], data[1]) for data in sorted_stats[:5])
|
|
|
|
await ctx.send(
|
|
|
|
"This server's top {} most used commands are:\n```\n{}```".format(len(sorted_stats[:5]), top_5))
|
2016-09-30 06:29:57 +13:00
|
|
|
else:
|
2017-03-08 11:35:30 +13:00
|
|
|
await ctx.send("That is not a valid option, valid options are: `server` or `me`")
|
2016-09-26 16:58:33 +13:00
|
|
|
|
2017-03-08 11:35:30 +13:00
|
|
|
@commands.command(no_pm=True)
|
2017-02-13 10:30:50 +13:00
|
|
|
@utils.custom_perms(send_messages=True)
|
2016-07-09 13:27:19 +12:00
|
|
|
async def mostboops(self, ctx):
|
2016-11-29 17:55:55 +13:00
|
|
|
"""Shows the person you have 'booped' the most, as well as how many times
|
|
|
|
|
|
|
|
EXAMPLE: !mostboops
|
|
|
|
RESULT: You've booped @OtherPerson 351253897120935712093572193057310298 times!"""
|
2017-03-08 20:55:22 +13:00
|
|
|
boops = await utils.get_content('boops', str(ctx.message.author.id))
|
2016-09-29 12:39:34 +13:00
|
|
|
if boops is None:
|
2017-03-08 11:35:30 +13:00
|
|
|
await ctx.send("You have not booped anyone {} Why the heck not...?".format(ctx.message.author.mention))
|
2016-07-18 03:19:41 +12:00
|
|
|
return
|
2016-09-26 16:58:33 +13:00
|
|
|
|
2016-09-29 12:39:34 +13:00
|
|
|
# Just to make this easier, just pay attention to the boops data, now that we have the right entry
|
2017-03-08 19:43:40 +13:00
|
|
|
boops = boops['boops']
|
2016-09-29 12:39:34 +13:00
|
|
|
|
2016-08-16 15:30:52 +12:00
|
|
|
# First get a list of the ID's of all members in this server, for use in list comprehension
|
2017-03-08 20:55:22 +13:00
|
|
|
server_member_ids = [str(member.id) for member in ctx.message.guild.members]
|
2016-08-16 15:30:52 +12:00
|
|
|
# Then get a sorted list, based on the amount of times they've booped the member
|
|
|
|
# Reverse needs to be true, as we want it to go from highest to lowest
|
2016-09-29 14:00:41 +13:00
|
|
|
sorted_boops = sorted(boops.items(), key=lambda x: x[1], reverse=True)
|
2016-08-17 03:22:32 +12:00
|
|
|
# Then override the same list, checking if the member they've booped is in this server
|
2016-07-29 04:59:12 +12:00
|
|
|
sorted_boops = [x for x in sorted_boops if x[0] in server_member_ids]
|
2016-09-26 16:58:33 +13:00
|
|
|
|
2016-08-16 15:30:52 +12:00
|
|
|
# Since this is sorted, we just need to get the following information on the first user in the list
|
2016-09-29 14:00:41 +13:00
|
|
|
most_id, most_boops = sorted_boops[0]
|
|
|
|
|
2017-03-21 11:26:26 +13:00
|
|
|
member = ctx.message.guild.get_member(int(most_id))
|
|
|
|
|
2017-03-08 11:35:30 +13:00
|
|
|
await ctx.send("{0} you have booped {1} the most amount of times, coming in at {2} times".format(
|
2017-02-13 10:30:50 +13:00
|
|
|
ctx.message.author.mention, member.display_name, most_boops))
|
2016-07-09 13:27:19 +12:00
|
|
|
|
2017-03-08 11:35:30 +13:00
|
|
|
@commands.command(no_pm=True)
|
2017-02-13 10:30:50 +13:00
|
|
|
@utils.custom_perms(send_messages=True)
|
2016-07-09 13:59:10 +12:00
|
|
|
async def listboops(self, ctx):
|
2016-11-29 17:55:55 +13:00
|
|
|
"""Lists all the users you have booped and the amount of times
|
|
|
|
|
|
|
|
EXAMPLE: !listboops
|
|
|
|
RESULT: The list of your booped members!"""
|
2017-03-20 12:04:52 +13:00
|
|
|
await ctx.message.channel.trigger_typing()
|
|
|
|
|
2017-03-08 20:55:22 +13:00
|
|
|
boops = await utils.get_content('boops', str(ctx.message.author.id))
|
2016-09-29 12:39:34 +13:00
|
|
|
if boops is None:
|
2017-03-08 11:35:30 +13:00
|
|
|
await ctx.send("You have not booped anyone {} Why the heck not...?".format(ctx.message.author.mention))
|
2016-07-18 03:17:47 +12:00
|
|
|
return
|
2016-09-26 16:58:33 +13:00
|
|
|
|
2016-09-29 12:39:34 +13:00
|
|
|
# Just to make this easier, just pay attention to the boops data, now that we have the right entry
|
2017-03-08 19:43:40 +13:00
|
|
|
boops = boops['boops']
|
2016-09-29 12:39:34 +13:00
|
|
|
|
2016-08-16 15:30:52 +12:00
|
|
|
# Same concept as the mostboops method
|
2017-03-09 08:36:11 +13:00
|
|
|
server_member_ids = [member.id for member in ctx.message.guild.members]
|
2017-03-09 08:43:15 +13:00
|
|
|
booped_members = {int(m_id): amt for m_id, amt in boops.items() if int(m_id) in server_member_ids}
|
2016-08-19 05:49:45 +12:00
|
|
|
sorted_booped_members = sorted(booped_members.items(), key=lambda k: k[1], reverse=True)
|
2016-10-02 13:41:41 +13:00
|
|
|
# Now we only want the first 10 members, so splice this list
|
|
|
|
sorted_booped_members = sorted_booped_members[:10]
|
|
|
|
|
2016-10-16 18:27:07 +13:00
|
|
|
try:
|
2017-03-08 11:35:30 +13:00
|
|
|
output = [("{0.display_name}".format(ctx.message.guild.get_member(m_id)), amt)
|
2016-11-02 08:34:05 +13:00
|
|
|
for m_id, amt in sorted_booped_members]
|
2017-02-13 10:45:11 +13:00
|
|
|
banner = await utils.create_banner(ctx.message.author, "Your booped victims", output)
|
2017-03-08 11:35:30 +13:00
|
|
|
await ctx.send(file=banner)
|
2016-10-16 18:27:07 +13:00
|
|
|
except (FileNotFoundError, discord.Forbidden):
|
2016-10-02 13:41:41 +13:00
|
|
|
output = "\n".join(
|
2017-03-08 11:35:30 +13:00
|
|
|
"{0.display_name}: {1} times".format(ctx.message.guild.get_member(m_id), amt) for
|
2016-10-02 13:41:41 +13:00
|
|
|
m_id, amt in sorted_booped_members)
|
2017-03-08 11:35:30 +13:00
|
|
|
await ctx.send("You have booped:```\n{}```".format(output))
|
2016-07-09 13:59:10 +12:00
|
|
|
|
2017-03-08 11:35:30 +13:00
|
|
|
@commands.command(no_pm=True)
|
2017-02-13 10:30:50 +13:00
|
|
|
@utils.custom_perms(send_messages=True)
|
2016-07-26 03:58:39 +12:00
|
|
|
async def leaderboard(self, ctx):
|
2016-11-29 17:55:55 +13:00
|
|
|
"""Prints a leaderboard of everyone in the server's battling record
|
|
|
|
|
|
|
|
EXAMPLE: !leaderboard
|
|
|
|
RESULT: A leaderboard of this server's battle records"""
|
2017-03-20 12:04:52 +13:00
|
|
|
await ctx.message.channel.trigger_typing()
|
|
|
|
|
2016-09-29 12:39:34 +13:00
|
|
|
# Create a list of the ID's of all members in this server, for comparison to the records saved
|
2017-03-09 08:36:11 +13:00
|
|
|
server_member_ids = [member.id for member in ctx.message.guild.members]
|
2017-02-13 10:30:50 +13:00
|
|
|
battles = await utils.get_content('battle_records')
|
2017-03-09 08:36:11 +13:00
|
|
|
if battles is None or len(battles) == 0:
|
|
|
|
await ctx.send("No one has battled on this server!")
|
|
|
|
|
|
|
|
battles = [battle for battle in battles if int(battle['member_id']) in server_member_ids]
|
2016-09-29 12:39:34 +13:00
|
|
|
|
|
|
|
# Sort the members based on their rating
|
|
|
|
sorted_members = sorted(battles, key=lambda k: k['rating'], reverse=True)
|
2016-07-31 12:20:55 +12:00
|
|
|
|
2016-10-31 10:54:58 +13:00
|
|
|
output = []
|
2016-07-26 06:43:17 +12:00
|
|
|
for x in sorted_members:
|
2017-03-09 08:43:15 +13:00
|
|
|
member_id = int(x['member_id'])
|
2016-09-29 14:00:41 +13:00
|
|
|
rating = x['rating']
|
2017-03-08 11:35:30 +13:00
|
|
|
member = ctx.message.guild.get_member(member_id)
|
2017-02-13 10:30:50 +13:00
|
|
|
output.append("{} (Rating: {})".format(member.display_name, rating))
|
2016-10-02 13:41:41 +13:00
|
|
|
|
2017-02-13 12:36:11 +13:00
|
|
|
try:
|
2017-02-13 12:58:27 +13:00
|
|
|
pages = utils.Pages(self.bot, message=ctx.message, entries=output)
|
2017-02-13 12:36:11 +13:00
|
|
|
await pages.paginate()
|
|
|
|
except utils.CannotPaginate as e:
|
2017-03-08 11:35:30 +13:00
|
|
|
await ctx.send(str(e))
|
2016-07-31 12:20:55 +12:00
|
|
|
|
2017-03-08 11:35:30 +13:00
|
|
|
@commands.command(no_pm=True)
|
2017-02-13 10:30:50 +13:00
|
|
|
@utils.custom_perms(send_messages=True)
|
2016-09-29 12:39:34 +13:00
|
|
|
async def stats(self, ctx, member: discord.Member = None):
|
2016-11-29 17:55:55 +13:00
|
|
|
"""Prints the battling stats for you, or the user provided
|
|
|
|
|
|
|
|
EXAMPLE: !stats @OtherPerson
|
|
|
|
RESULT: How good they are at winning a completely luck based game"""
|
2017-03-20 12:04:52 +13:00
|
|
|
await ctx.message.channel.trigger_typing()
|
|
|
|
|
2016-07-26 07:57:47 +12:00
|
|
|
member = member or ctx.message.author
|
2016-07-31 12:20:55 +12:00
|
|
|
|
2016-09-29 12:39:34 +13:00
|
|
|
# For this one, we don't want to pass a filter, as we do need all battle records
|
|
|
|
# We need this because we want to make a comparison for overall rank
|
2017-02-13 10:30:50 +13:00
|
|
|
all_members = await utils.get_content('battle_records')
|
2017-03-09 08:36:11 +13:00
|
|
|
if all_members is None or len(all_members) == 0:
|
|
|
|
await ctx.send("You have not battled anyone!")
|
2016-09-29 12:39:34 +13:00
|
|
|
|
|
|
|
# Make a list comprehension to just check if the user has battled
|
2017-03-08 20:55:22 +13:00
|
|
|
if len([entry for entry in all_members if entry['member_id'] == str(member.id)]) == 0:
|
2017-03-08 11:35:30 +13:00
|
|
|
await ctx.send("That user has not battled yet!")
|
2016-07-26 07:57:47 +12:00
|
|
|
return
|
2016-07-31 12:20:55 +12:00
|
|
|
|
2016-08-16 15:30:52 +12:00
|
|
|
# Same concept as the leaderboard
|
2017-03-09 08:36:11 +13:00
|
|
|
server_member_ids = [member.id for member in ctx.message.guild.members]
|
|
|
|
server_members = [stats for stats in all_members if int(stats['member_id']) in server_member_ids]
|
2016-09-29 14:19:45 +13:00
|
|
|
sorted_server_members = sorted(server_members, key=lambda x: x['rating'], reverse=True)
|
|
|
|
sorted_all_members = sorted(all_members, key=lambda x: x['rating'], reverse=True)
|
2016-09-26 16:58:33 +13:00
|
|
|
|
2016-08-17 03:22:32 +12:00
|
|
|
# Enumurate the list so that we can go through, find the user's place in the list
|
|
|
|
# and get just that for the rank
|
2017-03-08 20:55:22 +13:00
|
|
|
server_rank = [i for i, x in enumerate(sorted_server_members) if x['member_id'] == str(member.id)][0] + 1
|
|
|
|
total_rank = [i for i, x in enumerate(sorted_all_members) if x['member_id'] == str(member.id)][0] + 1
|
2016-08-16 15:30:52 +12:00
|
|
|
# The rest of this is straight forward, just formatting
|
2016-09-29 14:19:45 +13:00
|
|
|
|
2017-03-08 20:55:22 +13:00
|
|
|
entry = [m for m in server_members if m['member_id'] == str(member.id)][0]
|
2016-09-29 14:19:45 +13:00
|
|
|
rating = entry['rating']
|
|
|
|
record = "{}-{}".format(entry['wins'], entry['losses'])
|
2016-11-02 08:34:05 +13:00
|
|
|
try:
|
|
|
|
title = 'Stats for {}'.format(member.display_name)
|
|
|
|
fmt = [('Record', record), ('Server Rank', '{}/{}'.format(server_rank, len(server_members))),
|
|
|
|
('Overall Rank', '{}/{}'.format(total_rank, len(all_members))), ('Rating', rating)]
|
2017-02-13 10:45:11 +13:00
|
|
|
banner = await utils.create_banner(member, title, fmt)
|
2017-03-08 11:35:30 +13:00
|
|
|
await ctx.send(file=banner)
|
2016-11-02 08:34:05 +13:00
|
|
|
except (FileNotFoundError, discord.Forbidden):
|
|
|
|
fmt = 'Stats for {}:\n\tRecord: {}\n\tServer Rank: {}/{}\n\tOverall Rank: {}/{}\n\tRating: {}'
|
|
|
|
fmt = fmt.format(member.display_name, record, server_rank, len(server_members), total_rank,
|
|
|
|
len(all_members), rating)
|
2017-03-08 11:35:30 +13:00
|
|
|
await ctx.send('```\n{}```'.format(fmt))
|
2016-07-09 13:27:19 +12:00
|
|
|
|
2016-07-31 12:20:55 +12:00
|
|
|
|
2016-07-09 13:27:19 +12:00
|
|
|
def setup(bot):
|
|
|
|
bot.add_cog(Stats(bot))
|