From 127fe651829637b63c046af618347f86c1bb8dda Mon Sep 17 00:00:00 2001 From: Luis Pino Date: Tue, 22 Oct 2019 12:23:23 -0400 Subject: [PATCH 1/7] Agregada funcion del comando "Ayuda" --- funciones.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/funciones.py b/funciones.py index 00930c5..c84b2be 100644 --- a/funciones.py +++ b/funciones.py @@ -7,7 +7,7 @@ # # Date: October - 2019 -#Listener +# Listener def listener(messages): @@ -24,4 +24,17 @@ def listener(messages): f.write(mensaje + "\n") # Escribimos la linea de log en el fichero. f.close() # Cerramos el fichero para que se guarde. - print mensaje # Imprimimos el mensaje en la terminal, que nunca viene mal : \ No newline at end of file + print mensaje # Imprimimos el mensaje en la terminal, que nunca + +#### COMANDOS DISPONIBLES + +# Ayuda +def command_ayuda(m): + + cid = m.chat.id # Guardamos el ID de la conversación para poder responder. + + bot.send_chat_action(cid, 'typing') # Enviando ... + + time.sleep(1) #La respuesta del bot tarda 1 segundo en ejecutarse + + bot.send_message( cid, AYUDA) # Con la función 'send_message()' del bot, enviamos al ID almacenado el texto que queremos. \ No newline at end of file From 1bd01c43e4fd4574a7e05c4afd6cbd5e9f8f814a Mon Sep 17 00:00:00 2001 From: Luis Pino Date: Tue, 22 Oct 2019 12:27:34 -0400 Subject: [PATCH 2/7] Agregado handler para el boton de info --- bot.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bot.py b/bot.py index 24bf16d..f2f97c8 100644 --- a/bot.py +++ b/bot.py @@ -29,6 +29,7 @@ bot = telebot.TeleBot(TOKEN) # Creamos el objeto de nuestro bot. @bot.message_handler(commands=['ayuda']) +@bot.message_handler(commands=['info']) # Indicamos que lo siguiente va a controlar el comando '/info' bot.set_update_listener(listener) # Así, le decimos al bot que utilice como función escuchadora nuestra función 'listener' declarada arriba. From 53039e7c520f0bed59ad82fb9d0b3fa6bfe1863a Mon Sep 17 00:00:00 2001 From: Luis Pino Date: Tue, 22 Oct 2019 12:28:13 -0400 Subject: [PATCH 3/7] Cambiado formato en ayuda --- funciones.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/funciones.py b/funciones.py index c84b2be..fd0ed3b 100644 --- a/funciones.py +++ b/funciones.py @@ -30,11 +30,9 @@ def listener(messages): # Ayuda def command_ayuda(m): - cid = m.chat.id # Guardamos el ID de la conversación para poder responder. - bot.send_chat_action(cid, 'typing') # Enviando ... - time.sleep(1) #La respuesta del bot tarda 1 segundo en ejecutarse - - bot.send_message( cid, AYUDA) # Con la función 'send_message()' del bot, enviamos al ID almacenado el texto que queremos. \ No newline at end of file + bot.send_message( cid, AYUDA) # Con la función 'send_message()' del bot, enviamos al ID almacenado el texto que queremos. + +# Info From bd6f52017629c21b31695e6518e108de30dda8dd Mon Sep 17 00:00:00 2001 From: Luis Pino Date: Tue, 22 Oct 2019 12:32:46 -0400 Subject: [PATCH 4/7] Agregada funcion del comando info --- funciones.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/funciones.py b/funciones.py index fd0ed3b..43b7951 100644 --- a/funciones.py +++ b/funciones.py @@ -36,3 +36,11 @@ def command_ayuda(m): bot.send_message( cid, AYUDA) # Con la función 'send_message()' del bot, enviamos al ID almacenado el texto que queremos. # Info +def command_info(m): # Definimos una función que resuleva lo que necesitemos. + cid = m.chat.id # Guardamos el ID de la conversación para poder responder. + + if cid == GRUPO: + bot.send_message( GRUPO, 'mensaje A') # Con la función 'send_message()' del bot, enviamos al ID almacenado el texto que queremos. + + else : + bot.send_message( cid, 'mensaje B') \ No newline at end of file From 6753e2c1abd92407418a6c0e38c3923795bf2592 Mon Sep 17 00:00:00 2001 From: Luis Pino Date: Tue, 22 Oct 2019 12:44:58 -0400 Subject: [PATCH 5/7] Agregada respuesta a Hola --- bot.py | 5 ++++- funciones.py | 10 +++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index f2f97c8..5ad75e9 100644 --- a/bot.py +++ b/bot.py @@ -30,7 +30,10 @@ @bot.message_handler(commands=['ayuda']) @bot.message_handler(commands=['info']) # Indicamos que lo siguiente va a controlar el comando '/info' - + +## Mensajes de Lectura Inline +@bot.message_handler(func=lambda message: message.text == "hola") + bot.set_update_listener(listener) # Así, le decimos al bot que utilice como función escuchadora nuestra función 'listener' declarada arriba. diff --git a/funciones.py b/funciones.py index 43b7951..4e52242 100644 --- a/funciones.py +++ b/funciones.py @@ -43,4 +43,12 @@ def command_info(m): # Definimos una función que resuleva lo que necesitemos. bot.send_message( GRUPO, 'mensaje A') # Con la función 'send_message()' del bot, enviamos al ID almacenado el texto que queremos. else : - bot.send_message( cid, 'mensaje B') \ No newline at end of file + bot.send_message( cid, 'mensaje B') + + +### MENSAJES INLINE +def command_text_hola(m): + + time.sleep(1) + + bot.send_message(m.chat.id, "Hola a ti tambien") \ No newline at end of file From 744a636c06296cf23c73fc3ae62946a19d1cc14d Mon Sep 17 00:00:00 2001 From: Luis Pino Date: Tue, 22 Oct 2019 12:50:06 -0400 Subject: [PATCH 6/7] Agregada base del comando Saldo --- bot.py | 1 + funciones.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index 5ad75e9..a5dd700 100644 --- a/bot.py +++ b/bot.py @@ -30,6 +30,7 @@ @bot.message_handler(commands=['ayuda']) @bot.message_handler(commands=['info']) # Indicamos que lo siguiente va a controlar el comando '/info' +@bot.message_handler(commands=['saldo']) # Indicamos que lo siguiente va a controlar el comando '/info' ## Mensajes de Lectura Inline @bot.message_handler(func=lambda message: message.text == "hola") diff --git a/funciones.py b/funciones.py index 4e52242..0e26c05 100644 --- a/funciones.py +++ b/funciones.py @@ -45,10 +45,14 @@ def command_info(m): # Definimos una función que resuleva lo que necesitemos. else : bot.send_message( cid, 'mensaje B') +# Saldo +def command_saldo(m): + cid = m.chat.id # Guardamos el ID de la conversación para poder responder. + time.sleep(1) + bot.send_message(m.chat.id, "Esta funcion estara disponible en el siguiente release") + ### MENSAJES INLINE def command_text_hola(m): - time.sleep(1) - bot.send_message(m.chat.id, "Hola a ti tambien") \ No newline at end of file From 088c2bb73b3ba7033bd0d1cbb6b58533e1df9de9 Mon Sep 17 00:00:00 2001 From: Luis Pino Date: Tue, 22 Oct 2019 12:56:09 -0400 Subject: [PATCH 7/7] Agregadas funciones basicas para beta release --- bot.py | 3 +++ funciones.py | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index a5dd700..ca8e03c 100644 --- a/bot.py +++ b/bot.py @@ -34,6 +34,9 @@ ## Mensajes de Lectura Inline @bot.message_handler(func=lambda message: message.text == "hola") +@bot.message_handler(func=lambda message: message.text == "Que es esto") +@bot.message_handler(func=lambda message: message.text == "Como lo uso") +@bot.message_handler(func=lambda message: message.text == "Esto es una beta") bot.set_update_listener(listener) # Así, le decimos al bot que utilice como función escuchadora nuestra función 'listener' declarada arriba. diff --git a/funciones.py b/funciones.py index 0e26c05..209cdfd 100644 --- a/funciones.py +++ b/funciones.py @@ -55,4 +55,16 @@ def command_saldo(m): ### MENSAJES INLINE def command_text_hola(m): time.sleep(1) - bot.send_message(m.chat.id, "Hola a ti tambien") \ No newline at end of file + bot.send_message(m.chat.id, "Hola a ti tambien") + +def command_text_Que_es_esto(m): + time.sleep(1) + bot.send_message(m.chat.id, "Es uno de los nuevos metodos de comunicacion del USBCEIC") + +def command_text_Como_lo_uso(m): + time.sleep(1) + bot.send_message(m.chat.id, "EScribe el comando /ayuda para ver las opciones disponibles y de que se trata el bot") + +def command_text_Esto_es_una_beta(m): + time.sleep(1) + bot.send_message(m.chat.id, "Si, efectivamente, es una beta que estara disponible hasta el siguiente release") \ No newline at end of file