diff --git a/cogs/roll.py b/cogs/roll.py index 9d4953b..2255dd3 100644 --- a/cogs/roll.py +++ b/cogs/roll.py @@ -30,7 +30,7 @@ class Roll(commands.Cog): elif(rolled <= 50 and rolled > 25): rating = "Meh" elif(rolled <= 25 and rolled > 1): - rating = "Almost" + rating = "Bad" elif(rolled == 1): rating = "LOL" diff --git a/cogs/stats.py b/cogs/stats.py new file mode 100644 index 0000000..2c2e22f --- /dev/null +++ b/cogs/stats.py @@ -0,0 +1,47 @@ +from urllib import request +import discord +from discord.ext import commands +import requests + +class Stats(commands.Cog): + def __init__(self, client): + self.client = client + + @commands.Cog.listener() + async def on_ready(self): + print("stats.py is ready") + + @commands.command() + async def stats(self, ctx, pmessage="any player", message2="any weapon"): + message = pmessage + print(message) + print(message2) + if(message != "any player"): + if(message2 != "any weapon"): + message = message[:-1] + response = requests.get('https://tone.sleepycat.date/v2/client/players').json() + r = response.keys() + playerid = "" + for i in r: + p = response[i]['username'] + if (p == message): + playerid = i + break + + if (playerid != ""): + killstats = response[playerid] + botmessage = str( + "Playername: " + killstats['username'] + '\n' + + "Kills: " + str(killstats['kills']) + '\n' + + "Deaths " + str(killstats['deaths']) + '\n' + + "KD: " + str("{:0.2f}".format(killstats['kills']/killstats['deaths'])) + ) + else: + botmessage = "This player doesnt exist" + else: + botmessage = "No name given" + await ctx.send(botmessage) + + +async def setup(client): + await client.add_cog(Stats(client)) \ No newline at end of file