Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. def Aggiungi():
  2. from numeri import numero #Importa il file numeri, dove ogni volta che viene cliccato il tasto "✅" aggiunge un voto.
  3. numero2 = numero + 1
  4. numeri = open("numeri.py", "w")
  5. numeri.write("numero = " + str(numero2))
  6. numeri.close() #Prende il valore precedente di "numero" e gli aggiunge 1
  7.  
  8.  
  9.  
  10.  
  11.  
  12. #momento dell'invio del comando
  13. @bot.command("test")
  14. def portoarmi_command(chat, message, args):
  15. if len(args) == 0:
  16. chat.send("Inserisci un Nickname")
  17. elif len(args) != 1:
  18. chat.send("Non puoi inserire due o più valori")
  19. close()
  20. username = args[0]
  21. chat.send("💣 *MINEWOOD | PORTO D'ARMI* \n \n ℹ️ Hai attivato la richiesta del \n *porto d'armi* per l'utente *%s*. \n \n✅ *Voti a favore*: 0 \n⛔️ *Voti a sfavore*: 0" % username, attach=btns2)
  22. username_file = open("username.txt", "w+")
  23. username_file.write(username)
  24. username_file.close()
  25.  
  26.  
  27.  
  28. #Una volta cliccato su "✅" aggiunge un voto.
  29. @bot.callback("Positivo")
  30. def positivo_callblack(query, chat, message):
  31. Aggiungi()
  32. f=open('/home/username.txt') #Prende l'username della persona scelta nel comando precendete
  33. lines=f.readlines()
  34. string = lines[0]
  35. message.edit("💣 *MINEWOOD | PORTO D'ARMI* \n \n ℹ️ Hai attivato la richiesta del \n *porto d'armi* per l'utente %s \n \n✅ *Voti a favore*: %s \n⛔️ *Voti a sfavore*: %s" % (string, numero, string), attach=btns2)
  36. query.notify("Voto aggiunto con successo!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement