From 1c1eb78a33b82a7f5e3672bc10ea6afa7a04228c Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 6 Oct 2015 18:17:36 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=BA=F0=9F=8E=BA=20=F0=9F=8E=BA?= =?UTF-8?q?=F0=9F=8E=BA=20=F0=9F=8E=BA=F0=9F=8E=BA=F0=9F=8E=BA=F0=9F=8E=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ๐ŸŽบ๐ŸŽบ๐ŸŽบ๐ŸŽบ๐ŸŽบ๐ŸŽบ๐ŸŽบ๐ŸŽบ --- bot.py | 6 ++++-- telegram.py | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index 4691dd0d..b376cf7e 100644 --- a/bot.py +++ b/bot.py @@ -24,7 +24,6 @@ while(True): if(n == None): telegram.sendMessage(chr(9888) + " L'app specificata non esiste!", sby) else: - if(cmd[1] telegram.sendMessage("In questo momento, " + str(n) + " persone stanno giocando a [" + cmd[1] + "](https://steamdb.info/app/" + cmd[1] + "/graphs/)", sby) else: telegram.sendMessage(chr(9888) + " Non hai specificato un AppID!\nLa sintassi corretta รจ /playing .", sby) @@ -33,4 +32,7 @@ while(True): 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) \ No newline at end of file + 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.sendAudio("BQADAgAD3QEAAh8GgAFVqHhBraLsRwI", sby) \ No newline at end of file diff --git a/telegram.py b/telegram.py index 34add0a6..e4db4a20 100644 --- a/telegram.py +++ b/telegram.py @@ -44,6 +44,15 @@ def forwardMessage(msg, sentby, to): #Manda la richiesta ai server di Telegram. requests.get("https://api.telegram.org/bot" + telegramtoken + "/forwardMessage", params=parametri) +def sendAudio(audio, to): + """Manda un audio a una chat.""" + parametri = { + 'chat_id': to, + 'audio': audio, + } + #Manda la richiesta ai server di Telegram. + requests.get("https://api.telegram.org/bot" + telegramtoken + "/sendAudio", params=parametri) + def sendLocation(lat, long, to): """Manda una posizione sulla mappa.""" #Parametri del messaggio