1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-24 03:54:20 +00:00

Aggiunta gestione errori nel comando /osu

This commit is contained in:
Steffo 2016-01-26 19:04:56 +01:00
parent 7c5b50359d
commit bbd1a076c8

128
bot.py
View file

@ -190,7 +190,7 @@ while True:
";/scroll:%23gamelist).", sentin) ";/scroll:%23gamelist).", sentin)
else: else:
telegram.sendmessage(chr(9888) + telegram.sendmessage(chr(9888) +
"Non hai specificato un gioco!" " Non hai specificato un gioco!"
"[Visualizza tutte le offerte]" "[Visualizza tutte le offerte]"
"(https://isthereanydeal.com/#/search:.;/scroll:%23gamelist).", "(https://isthereanydeal.com/#/search:.;/scroll:%23gamelist).",
sentin) sentin)
@ -228,67 +228,71 @@ while True:
else: else:
# Osu! normale # Osu! normale
mode = 0 mode = 0
r = osu.getuserrecent(cmd[1], mode) try:
if mode == 0: r = osu.getuserrecent(cmd[1], mode)
telegram.sendmessage("*Osu!*\n" except NameError:
"[Beatmap " + r['beatmap_id'] + "](" + 'https://osu.ppy.sh/b/' + r[ telegram.sendmessage(chr(9888) + " Errore nella richiesta ai server di Osu!", sentin)
'beatmap_id'] + else:
")\n*" + r['rank'] + "*\n*Punti*: " + r['score'] + "\n" if mode == 0:
"*Combo* x" + r['maxcombo'] + "\n" telegram.sendmessage("*Osu!*\n"
"*300*: " + r['count300'] + "\n" "[Beatmap " + r['beatmap_id'] + "](" + 'https://osu.ppy.sh/b/' + r[
"*100*: " + r['count100'] + "\n" 'beatmap_id'] +
"*50*: " + r['count50'] + "\n" ")\n*" + r['rank'] + "*\n*Punti*: " + r['score'] + "\n"
"*Awesome*: " + r['countkatu'] + "\n" "*Combo* x" + r['maxcombo'] + "\n"
"*Good*: " + r['countgeki'] + "\n" "*300*: " + r['count300'] + "\n"
"*Miss*: " + r['countmiss'], sentin) "*100*: " + r['count100'] + "\n"
elif mode == 1: "*50*: " + r['count50'] + "\n"
telegram.sendmessage("*Taiko*\n" "*Awesome*: " + r['countkatu'] + "\n"
"[Beatmap " + r['beatmap_id'] + "](" + 'https://osu.ppy.sh/b/' + r[ "*Good*: " + r['countgeki'] + "\n"
'beatmap_id'] + "*Miss*: " + r['countmiss'], sentin)
")\n*" + r['rank'] + "*\n*Punti*: " + r['score'] + "\n" elif mode == 1:
"*Combo* x" + r['maxcombo'] + "\n" telegram.sendmessage("*Taiko*\n"
"*Great*: " + r['count300'] + "\n" "[Beatmap " + r['beatmap_id'] + "](" + 'https://osu.ppy.sh/b/' + r[
"*Good*: " + r['count100'] + "\n" 'beatmap_id'] +
"_Large_ *Great*: " + r['countkatu'] + "\n" ")\n*" + r['rank'] + "*\n*Punti*: " + r['score'] + "\n"
"_Large_ *Good*: " + r['countgeki'] + "\n" "*Combo* x" + r['maxcombo'] + "\n"
"*Bad*: " + r['countmiss'], sentin) "*Great*: " + r['count300'] + "\n"
elif mode == 2: "*Good*: " + r['count100'] + "\n"
telegram.sendmessage("*Catch the Beat*\n" "_Large_ *Great*: " + r['countkatu'] + "\n"
"[Beatmap " + r['beatmap_id'] + "](" + 'https://osu.ppy.sh/b/' + r[ "_Large_ *Good*: " + r['countgeki'] + "\n"
'beatmap_id'] + "*Bad*: " + r['countmiss'], sentin)
")\n*" + r['rank'] + "*\n*Punti*: " + r['score'] + "\n" elif mode == 2:
"*Combo* x" + r['maxcombo'] + "\n" telegram.sendmessage("*Catch the Beat*\n"
"*Fruit*: " + r['count300'] + "\n" "[Beatmap " + r['beatmap_id'] + "](" + 'https://osu.ppy.sh/b/' + r[
"*Droplet* _tick_: " + r['count100'] + "\n" 'beatmap_id'] +
"*Droplet* _trail_: " + r['count50'] + "\n" ")\n*" + r['rank'] + "*\n*Punti*: " + r['score'] + "\n"
"*Miss*: " + r['countmiss'], sentin) "*Combo* x" + r['maxcombo'] + "\n"
elif mode == 3: "*Fruit*: " + r['count300'] + "\n"
telegram.sendmessage("*Osu!mania*\n" + "*Droplet* _tick_: " + r['count100'] + "\n"
"[Beatmap " + r['beatmap_id'] + "](" + 'https://osu.ppy.sh/b/' + r[ "*Droplet* _trail_: " + r['count50'] + "\n"
'beatmap_id'] + ")\n*" + r['rank'] + "*Miss*: " + r['countmiss'], sentin)
"*\n*Punti*: " + r['score'] + "\n" elif mode == 3:
"*Combo* x" + r['maxcombo'] + "\n" telegram.sendmessage("*Osu!mania*\n" +
"_Rainbow_ *300*: " + r['countgeki'] + "\n" "[Beatmap " + r['beatmap_id'] + "](" + 'https://osu.ppy.sh/b/' + r[
"*300*: " + r['count300'] + "\n" 'beatmap_id'] + ")\n*" + r['rank'] +
"*100*: " + r['count100'] + "\n" "*\n*Punti*: " + r['score'] + "\n"
"*200*: " + r['countkatu'] + "\n" "*Combo* x" + r['maxcombo'] + "\n"
"*50*: " + r['count50'] + "\n" "_Rainbow_ *300*: " + r['countgeki'] + "\n"
"*Miss*: " + r['countmiss'], sentin) "*300*: " + r['count300'] + "\n"
else: "*100*: " + r['count100'] + "\n"
# E' un po' una scorciatoia eh, peeerò... "*200*: " + r['countkatu'] + "\n"
if username.lower() in osunames: "*50*: " + r['count50'] + "\n"
r = osu.getuserrecent(osunames[username.lower()], 0) "*Miss*: " + r['countmiss'], sentin)
telegram.sendmessage("*Osu!*\n" else:
"[Beatmap " + r['beatmap_id'] + "](" + 'https://osu.ppy.sh/b/' + r[ # E' un po' una scorciatoia eh, peeerò...
'beatmap_id'] + if username.lower() in osunames:
")\n*" + r['rank'] + "*\n*Punti*: " + r['score'] + "\n" r = osu.getuserrecent(osunames[username.lower()], 0)
"*Combo* x" + r['maxcombo'] + "\n" telegram.sendmessage("*Osu!*\n"
"*300*: " + r['count300'] + "\n" "[Beatmap " + r['beatmap_id'] + "](" + 'https://osu.ppy.sh/b/' + r[
"*100*: " + r['count100'] + "\n" 'beatmap_id'] +
"*50*: " + r['count50'] + "\n" ")\n*" + r['rank'] + "*\n*Punti*: " + r['score'] + "\n"
"*Awesome*: " + r['countgeki'] + "\n" "*Combo* x" + r['maxcombo'] + "\n"
"*Good*: " + r['countkatu'] + "\n" "*300*: " + r['count300'] + "\n"
"*Miss*: " + r['countmiss'], sentin) "*100*: " + r['count100'] + "\n"
"*50*: " + r['count50'] + "\n"
"*Awesome*: " + r['countgeki'] + "\n"
"*Good*: " + r['countkatu'] + "\n"
"*Miss*: " + r['countmiss'], sentin)
elif text.startswith('/roll'): elif text.startswith('/roll'):
print("@" + username + ": /roll") print("@" + username + ": /roll")
cmd = text.split(' ', 1) cmd = text.split(' ', 1)