1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00

Il bot non crasha più se non scrivi l'audio da inviare

This commit is contained in:
Steffo 2016-04-09 23:58:25 +02:00
parent 0000b84f44
commit e4ec4c7925

6
bot.py
View file

@ -173,6 +173,7 @@ while True:
elif text.startswith('/audio'): elif text.startswith('/audio'):
print("@" + username + ": /audio") print("@" + username + ": /audio")
cmd = text.split(" ", 1) cmd = text.split(" ", 1)
if len(cmd) > 1:
if cmd[1] in audiolist: if cmd[1] in audiolist:
sendme = audiolist[cmd[1]] sendme = audiolist[cmd[1]]
telegram.senddocument(sendme, sentin, source) telegram.senddocument(sendme, sentin, source)
@ -181,6 +182,11 @@ while True:
for audio in audiolist: for audio in audiolist:
sendme += audio + "\n" sendme += audio + "\n"
telegram.sendmessage(sendme, sentin, source) telegram.sendmessage(sendme, sentin, source)
else:
sendme = chr(9888) + " Per mandare un audio, scrivi `/audio nomeaudio`\n*Audio disponibili*:\n"
for audio in audiolist:
sendme += audio + "\n"
telegram.sendmessage(sendme, sentin, source)
elif text.startswith('/sbam'): elif text.startswith('/sbam'):
print("@" + username + ": /sbam") print("@" + username + ": /sbam")
# Manda l'audio contenente gli sbam di tutti i membri Royal Games. # Manda l'audio contenente gli sbam di tutti i membri Royal Games.