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

41 lines
1.8 KiB
Python
Raw Normal View History

2015-10-07 08:49:14 +00:00
# -*- coding: utf-8 -*-
import telegram
import steam
2015-10-08 16:39:56 +00:00
import random
#Playlist di /rage, si riempie quando è vuota
rage = []
2015-10-04 17:48:45 +00:00
print("Bot avviato!")
while(True):
#Guarda il comando ricevuto.
msg = telegram.getUpdates()
2015-10-04 10:20:11 +00:00
cmd = msg['text'].split(' ', 1)
2015-10-03 21:36:05 +00:00
sby = msg['chat']['id']
2015-10-03 16:44:23 +00:00
if(cmd[0].startswith('/ahnonlosoio')):
2015-10-03 21:36:05 +00:00
telegram.sendMessage("Ah, non lo so nemmeno io!", sby)
elif(cmd[0].startswith('/ehoh')):
telegram.sendMessage("Eh, oh. Sono cose che capitano.", sby)
elif(cmd[0].startswith('/start')):
2015-10-06 15:47:08 +00:00
telegram.sendMessage("Ascolta, io mi starto quando mi pare. Anzi, quando Steffo ha voglia di aprirmi.", sby)
2015-10-03 21:36:05 +00:00
elif(cmd[0].startswith('/playing')):
2015-10-04 09:41:25 +00:00
if(len(cmd) >= 2):
2015-10-03 21:36:05 +00:00
n = steam.getNumberOfCurrentPlayers(cmd[1])
2015-10-04 09:36:21 +00:00
if(n == None):
telegram.sendMessage(chr(9888) + " L'app specificata non esiste!", sby)
else:
2015-10-04 10:20:11 +00:00
telegram.sendMessage("In questo momento, " + str(n) + " persone stanno giocando a [" + cmd[1] + "](https://steamdb.info/app/" + cmd[1] + "/graphs/)", sby)
2015-10-03 21:36:05 +00:00
else:
2015-10-04 10:20:11 +00:00
telegram.sendMessage(chr(9888) + " Non hai specificato un AppID!\nLa sintassi corretta è /playing <AppID>.", sby)
elif(cmd[0].startswith('/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')):
2015-10-08 16:39:56 +00:00
if(len(rage) <= 0):
#Elenco degli audio disponibili
rage = ['BQADAgAD3wEAAh8GgAE6ZnLP5_gFMwI', 'BQADAgAD5AEAAh8GgAGu0FpK_X2DuQI', 'BQADAgAD5gEAAh8GgAGvUTJ9meZixwI', 'BQADAgAD5wEAAh8GgAHJSoUnCr9WxwI']
random.shuffle(rage)
ragesend = rage.pop()
telegram.sendDocument(ragesend, sby)