Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Comando start
- @bot.message_handler(commands=['start'])
- def command_start(m):
- cid = m.chat.id
- consulta = "select id from usuarios where id=%d"%(cid)
- cursor.execute(consulta)
- resultado = cursor.fetchone()
- if resultado == None: # Con esta sentencia, hacemos que solo se ejecute lo de abajo cuando un usuario hace uso del bot por primera vez.
- consulta="insert into usuarios values(%d)"%(cid)
- cursor.execute(consulta)
- bot.send_message( cid, "Bienvenido a @League_of_Legends_bot\nWelcome to @League_of_Legends_bot\n______________________\nEste es un bot en español desarrollado por @Edurolp\nThis is a bot in Spanish designed by @Edurolp\n______________________\nEspero que te guste ^^\nI hope you like it ^^")
- command_help(m) # Forzamos mensaje de bienvenida al usar el bot por primera vez.
- print "-> [" + str(cid) + "]: Comando /start utilizado"
- alias = "@" + str(m.from_user.username)
- bot.send_message( admin, "Nuevo usuario\n\nNombre: " + str(m.from_user.first_name) + "\nAlias: " + alias + "\nID: " + str(cid))
- #Comando stop
- @bot.message_handler(commands=['stop'])
- def command_stop(m):
- cid = m.chat.id
- bot.send_message( cid, "😭😭😭Adios...😭😭😭\nRecuerda, si usas cualquier comando del bot, volverás a quedar suscrito")
- consulta = "delete from usuarios where id=(%d)"%(cid)
- cursor.execute(consulta)
- bot.send_message( admin, "El usuario <" + str(cid) + "> ha dejado de usar el bot.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement