1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

forse no crash

This commit is contained in:
Steffo 2015-10-07 10:49:14 +02:00
parent 7b6a5bdaa5
commit d3a680f0e9

9
bot.py
View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import telegram
import steam
@ -8,17 +8,14 @@ while(True):
msg = telegram.getUpdates()
cmd = msg['text'].split(' ', 1)
sby = msg['chat']['id']
print(sby + ": " + repr(msg))
if(cmd[0].startswith('/ahnonlosoio')):
print('/ahnonlosoio')
telegram.sendMessage("Ah, non lo so nemmeno io!", sby)
elif(cmd[0].startswith('/ehoh')):
print('/ehoh')
telegram.sendMessage("Eh, oh. Sono cose che capitano.", sby)
elif(cmd[0].startswith('/start')):
print('/start')
telegram.sendMessage("Ascolta, io mi starto quando mi pare. Anzi, quando Steffo ha voglia di aprirmi.", sby)
elif(cmd[0].startswith('/playing')):
print('/playing ...')
if(len(cmd) >= 2):
n = steam.getNumberOfCurrentPlayers(cmd[1])
if(n == None):
@ -28,11 +25,9 @@ while(True):
else:
telegram.sendMessage(chr(9888) + " Non hai specificato un AppID!\nLa sintassi corretta è /playing <AppID>.", sby)
elif(cmd[0].startswith('/saldistim')):
print('/saldistim ...')
if(len(cmd) >= 2):
telegram.sendMessage("Ricerca di offerte di [" + cmd[1] + "](https://isthereanydeal.com/#/search:" + cmd[1].replace(' ', '%20') + ";/scroll:%23gamelist) completata.", sby)
else:
telegram.sendMessage(chr(9888) + " Non hai specificato un gioco! [Visualizza tutte le offerte](https://isthereanydeal.com/#/search:.;/scroll:%23gamelist).", sby)
elif(cmd[0].startswith('/rage')):
print('/rage')
telegram.sendDocument("BQADAgAD3wEAAh8GgAE6ZnLP5_gFMwI", sby)