Skip to content

Commit

Permalink
feat: agrego comando /ayuda y nuevo comando WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
SBen-IV committed Nov 24, 2023
1 parent a3e0ce5 commit 9e69c5e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,5 +160,6 @@ cython_debug/
.idea/

*.json
*.yaml

.devcontainer
11 changes: 11 additions & 0 deletions src/controllers/jjjameson.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def conseguir_noticias(self, update: Update, context: CallbackContext):
self.logger.warn("Cantidad de noticias no es número {arg}".format(arg=context.args[0]))
raise CantidadNoticiasNoEsNumeroException(arg=context.args[0])

def convertir_noticia(self, update: Update, context: CallbackContext):
update.effective_chat.send_message("Trabajando en esta feature...")

def __activar_noticias_automaticas(self, job_queue, chat):
self.job = job_queue.run_repeating(self.conseguir_noticias_automatico, INTERVALO_MENSAJES_AUTOMATICOS, context=chat)

Expand Down Expand Up @@ -85,3 +88,11 @@ def conseguir_noticias_automatico(self, context: CallbackContext):

def estado(self, update: Update, _: CallbackContext):
update.effective_chat.send_message("Noticias automáticas: {noticias_automaticas}".format(noticias_automaticas=self.noticias_automaticas))

def ayuda(self, update: Update, context: CallbackContext):
update.effective_chat.send_message("/noticias <n> - trae las últimas noticias\n"
+ "/convertir_noticia <url> - convierte la noticia\n"
+ "/empezar - \n"
+ "/terminar - \n"
+ "/estado - \n"
+ "/ayuda - imprime este mensaje\n")
2 changes: 2 additions & 0 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ def main():
filtro = Filters.chat(chat_id=int(os.getenv('ID_GRUPO_NOTICIAS')))

updater.dispatcher.add_handler(CommandHandler('noticias', jameson.conseguir_noticias, filtro))
updater.dispatcher.add_handler(CommandHandler('convertir_noticia', jameson.convertir_noticia, filtro))
updater.dispatcher.add_handler(CommandHandler('empezar', jameson.activar_noticias_automaticas, filtro))
updater.dispatcher.add_handler(CommandHandler('terminar', jameson.desactivar_noticias_automaticas, filtro))
updater.dispatcher.add_handler(CommandHandler('ayuda', jameson.ayuda, filtro))
updater.dispatcher.add_handler(CommandHandler('estado', jameson.estado, filtro))
updater.dispatcher.add_error_handler(error_handler)

Expand Down
1 change: 1 addition & 0 deletions src/view/interno.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Cindy Moon

0 comments on commit 9e69c5e

Please sign in to comment.