Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.94 KB | None | 0 0
  1. class Bot(threading.Thread):
  2.     def __init__(self, token=""):
  3.         super().__init__()
  4.         self.bot = botogram.create(token)
  5.         self.bot.run()
  6.  
  7.     def mainBot(self):
  8.         @self.bot.command("start")
  9.         def hello_command(chat, message, args):
  10.             btn = botogram.Buttons()
  11.             btn[0].callback("Avanti", "muovi", "avanti")
  12.             btn[1].callback("Sinistra", "muovi", "sx")
  13.             btn[1].callback("Destra", "muovi", "dx")
  14.             btn[2].callback("Indietro", "muovi", "indietro")
  15.             chat.send("Comando Robot", attach=btn)
  16.  
  17.         @self.bot.callback("muovi")
  18.         def muovi(query, data):
  19.             if data == "avanti":
  20.                 query.notify("Avanti")
  21.             elif data == "dx":
  22.                 query.notify("Destra")
  23.             elif data == "sx":
  24.                 query.notify("Sinistra")
  25.             elif data == "indietro":
  26.                 query.notify("Indietro")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement