diff --git a/bot.py b/bot.py index 431c7243..2375b454 100644 --- a/bot.py +++ b/bot.py @@ -62,16 +62,20 @@ while True: elif cmd[0].startswith('/sbam'): print(str(sby) + ": /sbam ") telegram.senddocument('BQADAgADTQIAAh8GgAGj0jKIrpTgvQI', sby) + elif cmd[0].startswith('/wololo'): + print(str(sby) + ": /wololo ") + telegram.senddocument('BQADAgADVAIAAh8GgAHqeZAqbBuFAwI', sby) elif cmd[0].startswith('/osunow'): print(str(sby) + ": /osunow ") if len(cmd) >= 2: + # Stavolta ci sono 3 argomenti... forse + cmd = msg['text'].split(' ', 2) if len(cmd) >= 3: r = osu.getuserrecent(cmd[1], cmd[2]) else: r = osu.getuserrecent(cmd[1]) - link = "https://osu.ppy.sh/b/" + r['beatmap_id'] - telegram.sendmessage("[Beatmap " + r['beatmap_id'] + "](" + link + ")\n*" + - r['rank'] + "*: " + r['score'] + "\n" + + telegram.sendmessage("[Beatmap " + r['beatmap_id'] + "](" + 'https://osu.ppy.sh/b/' + r['beatmap_id'] + + ")\n*" + r['rank'] + "*\n*Punti*: " + r['score'] + "\n" + "*Combo* x" + r['maxcombo'] + "\n" + "*300*: " + r['count300'] + "\n" + "*100*: " + r['count100'] + "\n" + diff --git a/osu.py b/osu.py index 8df39920..d9525ee0 100644 --- a/osu.py +++ b/osu.py @@ -72,7 +72,7 @@ def getuserrecent(user, mode=0): 'k': apikey, 'u': user, 'm': mode, + 'limit': 1, } r = requests.get("https://osu.ppy.sh/api/get_user_recent", params=parametri).json() - if len(r) >= 1: - return r[0] + return r[0]