✨ - New command $osu_acc {username} !
@@ -130,3 +130,6 @@ dmypy.json
|
||||
|
||||
# Tokens and IDs
|
||||
private.py
|
||||
|
||||
# Generated JPEG File
|
||||
acc.jpeg
|
||||
|
||||
@@ -15,19 +15,23 @@
|
||||
|
||||
<br>
|
||||
|
||||

|
||||

|
||||
|
||||
<br>
|
||||
|
||||

|
||||

|
||||
|
||||
<br>
|
||||
|
||||

|
||||

|
||||
|
||||
<br>
|
||||
|
||||

|
||||

|
||||
|
||||
<br>
|
||||
|
||||

|
||||
|
||||
<br>
|
||||
|
||||
@@ -67,14 +71,21 @@ This command will display a message with the current League of Legend rank of th
|
||||
```
|
||||
$osu_profile {osu_username}
|
||||
```
|
||||
This command will display a message with all the (basics) stats from the Osu! profile you ask for.
|
||||
This command will display a message with all the (basics) stats from the Osu! profile you ask for. Make sure to use quotes if there is spaces in the username.
|
||||
|
||||
|
||||
### **osu_lastgame**
|
||||
```
|
||||
$osu_lastgame {osu_username}
|
||||
```
|
||||
This command will display a message with all the stats from the last Osu! game the player you asked for played.
|
||||
This command will display a message with all the stats from the last Osu! game the player you asked for played. Make sure to use quotes if there is spaces in the username.
|
||||
|
||||
|
||||
### **osu_acc**
|
||||
```
|
||||
$osu_acc {osu_username}
|
||||
```
|
||||
This command will display the Accuracy of the player you asked for on his last games (with a maximum of 10 games).
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 226 KiB After Width: | Height: | Size: 226 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 100 KiB |
@@ -121,7 +121,6 @@ async def chat_stop(ctx):
|
||||
|
||||
@bot.command()
|
||||
async def rank(ctx, arg, argf=None):
|
||||
await del_message(ctx)
|
||||
if argf is None:
|
||||
try:
|
||||
player = WATCHER.summoner.by_name(REGION, arg)
|
||||
@@ -142,7 +141,7 @@ async def rank(ctx, arg, argf=None):
|
||||
except ApiError:
|
||||
await ctx.send('The username you entered is unknown.')
|
||||
else:
|
||||
await ctx.send('If you are trying to use a username you entered with spaces, please surround it with quotes.')
|
||||
await ctx.send('If you are trying to use a username with spaces, please surround it with quotes.')
|
||||
|
||||
|
||||
@bot.command()
|
||||
@@ -168,8 +167,8 @@ async def issou(ctx, arg1: discord.User = None):
|
||||
|
||||
|
||||
@bot.command()
|
||||
async def osu_profile(ctx, arg):
|
||||
await del_message(ctx)
|
||||
async def osu_profile(ctx, arg, argF=None):
|
||||
if argF is None:
|
||||
lst = await ask_osu_profile(arg)
|
||||
if lst == 1:
|
||||
await ctx.send('The username you entered is unknown.')
|
||||
@@ -191,11 +190,13 @@ async def osu_profile(ctx, arg):
|
||||
embed.add_field(name='Total Score', value=str('{:,}'.format(lst[4])))
|
||||
embed.add_field(name='Total Hits', value=str('{:,}'.format(lst[5])))
|
||||
await ctx.send(embed=embed)
|
||||
else:
|
||||
await ctx.send('If you are trying to use a username with spaces, please surround it with quotes.')
|
||||
|
||||
|
||||
@bot.command()
|
||||
async def osu_lastgame(ctx, arg):
|
||||
await del_message(ctx)
|
||||
async def osu_lastgame(ctx, arg, argF=None):
|
||||
if argF is None:
|
||||
lst = await ask_osu_last_game(arg)
|
||||
if lst == 1:
|
||||
await ctx.send('The player you entered is unknown or didn\'t played any game recently.')
|
||||
@@ -221,6 +222,20 @@ async def osu_lastgame(ctx, arg):
|
||||
embed.add_field(name='Miss', value=str(lst[15]))
|
||||
embed.add_field(name='|', value='|')
|
||||
await ctx.send(embed=embed)
|
||||
else:
|
||||
await ctx.send('If you are trying to use a username with spaces, please surround it with quotes.')
|
||||
|
||||
|
||||
@bot.command()
|
||||
async def osu_acc(ctx, arg, argF=None):
|
||||
if argF is None:
|
||||
test_acc = await ask_osu_acc(arg)
|
||||
if test_acc:
|
||||
await ctx.send(file=discord.File('acc.jpeg'))
|
||||
else:
|
||||
await ctx.send('The player you entered is unknown or didn\'t played any game recently.')
|
||||
else:
|
||||
await ctx.send('If you are trying to use a username with spaces, please surround it with quotes.')
|
||||
|
||||
|
||||
bot.run(TOKEN_BOT)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from osuapi import OsuApi, ReqConnector
|
||||
from private import TOKEN_OSU
|
||||
import requests
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
api = OsuApi(TOKEN_OSU, connector=ReqConnector())
|
||||
|
||||
@@ -25,3 +25,30 @@ async def ask_osu_last_game(username):
|
||||
lm.diff_approach, lm.diff_drain, lg.score,
|
||||
lg.maxcombo, lg.rank, lg.count300, lg.count100,
|
||||
lg.count50, lg.countmiss, lg.countkatu, lg.countgeki]
|
||||
|
||||
|
||||
async def ask_osu_acc(username):
|
||||
last_game = api.get_user_recent(username)
|
||||
if not last_game:
|
||||
return 0
|
||||
|
||||
lst = []
|
||||
for game in last_game:
|
||||
total = game.count300 + game.count100 + game.count50 + game.countmiss
|
||||
lst.append((float("%.2f" %(((game.count300 * 300) + (game.count100 * 100) + (game.count50 * 50)) / (total * 300) * 100))))
|
||||
|
||||
nb_games = len(lst)+1
|
||||
min_games = int(min(lst))
|
||||
|
||||
plt.figure(figsize=(9, 5))
|
||||
plt.plot(list(range(1, nb_games)), lst)
|
||||
plt.scatter(list(range(1, nb_games)), lst, color='red')
|
||||
plt.axis([1, nb_games-1, min_games, 100])
|
||||
plt.title('Accuracy of ' + username + ' on his last ' + str(nb_games-1) + ' games.')
|
||||
plt.xticks(range(1, nb_games))
|
||||
plt.yticks(range(min_games, 100, 5))
|
||||
plt.grid(linewidth=0.5)
|
||||
plt.ylabel('Accuracy (%)')
|
||||
plt.xlabel('Games (from recent to oldest)')
|
||||
plt.savefig('acc.jpeg')
|
||||
return 1
|
||||
|
||||