Herramientas de usuario

Herramientas del sitio


informatica:programacion:python:modulos:python-telegram-bot

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Ambos lados, revisión anteriorRevisión previa
Próxima revisión
Revisión previa
informatica:programacion:python:modulos:python-telegram-bot [2021/02/18 20:33] – [Fotos] tempwininformatica:programacion:python:modulos:python-telegram-bot [2021/06/23 11:28] (actual) – [Python: python-telegram-bot] tempwin
Línea 5: Línea 5:
   * [[https://python-telegram-bot.org/|Web oficial]]   * [[https://python-telegram-bot.org/|Web oficial]]
   * [[https://python-telegram-bot.readthedocs.io/en/stable/|Documentación oficial]]   * [[https://python-telegram-bot.readthedocs.io/en/stable/|Documentación oficial]]
 +
 +===== Instalación =====
 +
 +Se puede instalar a través del gestor de módulos de Python ''pip'':
 +
 +<code>
 +pip install python-telegram-bot
 +</code>
 +===== Hola, mundo =====
 +
 +Ejemplo de código que responde al texto ''/hola'':
 +
 +<code python>
 +from telegram import Update
 +from telegram.ext import Updater, CommandHandler, CallbackContext
 +
 +BOT_TOKEN = "1234567890:ABCDEF0123456789ABCDEF"
 +
 +
 +def hello(update: Update, context: CallbackContext) -> None:
 +    update.message.reply_text(f'Hola, {update.effective_user.first_name}')
 +
 +updater = Updater(BOT_TOKEN)
 +
 +updater.dispatcher.add_handler(CommandHandler('hello', hello))
 +
 +updater.start_polling()
 +updater.idle()
 +</code>
  
 ===== HTML ===== ===== HTML =====
informatica/programacion/python/modulos/python-telegram-bot.1613676809.txt.gz · Última modificación: por tempwin