Example #1
0
def steamplayers():
    print("@" + username + ": /steamplayers")
    # Informa Telegram che il messaggio è stato ricevuto e visualizza Royal Bot sta scrivendo.
    telegram.sendchataction(sentin)
    # Se è stato specificato un AppID...
    if len(cmd) >= 2:
        n = steam.getnumberofcurrentplayers(cmd[1])
        # Se viene ricevuta una risposta...
        if n is None:
            telegram.sendmessage(chr(9888) + " L'app specificata non esiste!", sentin, source)
        else:
            name = steam.getschemaforgame(cmd[1])['game']['gameName']
            telegram.sendmessage("In questo momento, *{n}* persone stanno giocando a "
                                 "[{name}](https://steamdb.info/app/{id}/graphs/)."
                                 .format(n=str(n), name=name, id=cmd[1]), sentin, source)
    else:
        telegram.sendmessage(chr(9888) + ' Non hai specificato un AppID!\n'
                                         'La sintassi corretta è /playing <AppID>.', sentin, source)
Example #2
0
def steamplayers():
    print("@" + username + ": /steamplayers")
    # Informa Telegram che il messaggio è stato ricevuto e visualizza Royal Bot sta scrivendo.
    telegram.sendchataction(sentin)
    # Se è stato specificato un AppID...
    if len(cmd) >= 2:
        n = steam.getnumberofcurrentplayers(cmd[1])
        # Se viene ricevuta una risposta...
        if n is None:
            telegram.sendmessage(
                chr(9888) + " L'app specificata non esiste!", sentin, source)
        else:
            name = steam.getschemaforgame(cmd[1])['game']['gameName']
            telegram.sendmessage(
                "In questo momento, *{n}* persone stanno giocando a "
                "[{name}](https://steamdb.info/app/{id}/graphs/).".format(
                    n=str(n), name=name, id=cmd[1]), sentin, source)
    else:
        telegram.sendmessage(
            chr(9888) + ' Non hai specificato un AppID!\n'
            'La sintassi corretta è /playing <AppID>.', sentin, source)
Example #3
0
def playing():
    print("@" + username + ": /playing")
    # Informa Telegram che il messaggio è stato ricevuto e visualizza Royal Bot sta scrivendo.
    telegram.sendchataction(sentin)
    cmd = text.split(" ")
    # Se è stato specificato un AppID...
    if len(cmd) >= 2:
        n = steam.getnumberofcurrentplayers(cmd[1])
        # Se viene ricevuta una risposta...
        if n is None:
            telegram.sendmessage(
                chr(9888) + " L'app specificata non esiste!", sentin, source)
        else:
            telegram.sendmessage(
                'In questo momento, ' + str(n) +
                ' persone stanno giocando a [' + cmd[1] +
                '](https://steamdb.info/app/' + cmd[1] + '/graphs/)', sentin,
                source)
    else:
        telegram.sendmessage(
            chr(9888) + ' Non hai specificato un AppID!\n'
            'La sintassi corretta è /playing <AppID>.', sentin, source)
Example #4
0
 elif text.startswith('/ciaoruozi'):
     print("@" + username + ": /ciaoruozi")
     # Ciao Ruozi.
     telegram.sendmessage("Ciao Ruozi", sentin, source)
 elif text.startswith('/ehoh'):
     print("@" + username + ": /ehoh")
     # Rispondi con Eh, oh. Sono cose che capitano.
     telegram.sendmessage("Eh, oh. Sono cose che capitano.", sentin, source)
 elif text.startswith('/playing'):
     print("@" + username + ": /playing")
     # Informa Telegram che il messaggio è stato ricevuto e visualizza Royal Bot sta scrivendo.
     telegram.sendchataction(sentin)
     cmd = text.split(" ")
     # Se è stato specificato un AppID...
     if len(cmd) >= 2:
         n = steam.getnumberofcurrentplayers(cmd[1])
         # Se viene ricevuta una risposta...
         if n is None:
             telegram.sendmessage(chr(9888) + " L'app specificata non esiste!", sentin, source)
         else:
             telegram.sendmessage(
                 'In questo momento, ' + str(n) + ' persone stanno giocando a [' + cmd[1] +
                 '](https://steamdb.info/app/' + cmd[1] + '/graphs/)', sentin, source)
     else:
         telegram.sendmessage(chr(9888) + ' Non hai specificato un AppID!\n'
                                          'La sintassi corretta è /playing <AppID>.', sentin, source)
 elif text.startswith('/saldi'):
     print("@" + username + ": /saldi")
     # Visualizza il link di isthereanydeal con i saldi di un gioco.
     # Informa Telegram che il messaggio è stato ricevuto e visualizza Royal Bot sta scrivendo.
     telegram.sendchataction(sentin)
Example #5
0
     unm = '@' + msg['from']['username']
 else:
     # Altrimenti, visualizza l'userID
     unm = str(msg['from']['id'])
 # Riconosci il comando.
 # Viene usato startswith perchè il comando potrebbe anche essere inviato in forma /ciao@RoyalBot.
 if cmd[0].startswith('/ahnonlosoio'):
     print(unm + ": /ahnonlosoio")
     telegram.sendmessage("Ah, non lo so nemmeno io!", sby)
 elif cmd[0].startswith('/ehoh'):
     print(unm + ": /ehoh")
     telegram.sendmessage("Eh, oh. Sono cose che capitano.", sby)
 elif cmd[0].startswith('/playing'):
     print(unm + ": /playing")
     if len(cmd) >= 2:
         n = steam.getnumberofcurrentplayers(cmd[1])
         if n is None:
             telegram.sendmessage(
                 chr(9888) + " L'app specificata non esiste!", sby)
         else:
             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!\n' +
             'La sintassi corretta è /playing <AppID>.', sby)
 elif cmd[0].startswith('/saldi'):
     print(unm + ": /saldi")