informatica:programacion:python:modulos:python-telegram-bot
Diferencias
Muestra las diferencias entre dos versiones de la página.
| Ambos lados, revisión anteriorRevisión previaPróxima revisión | Revisión previa | ||
| informatica:programacion:python:modulos:python-telegram-bot [2021/02/14 12:49] – [Mensajes] tempwin | informatica:programacion:python:modulos:python-telegram-bot [2021/06/23 11:28] (actual) – [Python: python-telegram-bot] tempwin | ||
|---|---|---|---|
| Línea 6: | Línea 6: | ||
| * [[https:// | * [[https:// | ||
| + | ===== Instalación ===== | ||
| + | |||
| + | Se puede instalar a través del gestor de módulos de Python '' | ||
| + | |||
| + | < | ||
| + | pip install python-telegram-bot | ||
| + | </ | ||
| + | ===== Hola, mundo ===== | ||
| + | |||
| + | Ejemplo de código que responde al texto ''/ | ||
| + | |||
| + | <code python> | ||
| + | from telegram import Update | ||
| + | from telegram.ext import Updater, CommandHandler, | ||
| + | |||
| + | BOT_TOKEN = " | ||
| + | |||
| + | |||
| + | def hello(update: | ||
| + | update.message.reply_text(f' | ||
| + | |||
| + | updater = Updater(BOT_TOKEN) | ||
| + | |||
| + | updater.dispatcher.add_handler(CommandHandler(' | ||
| + | |||
| + | updater.start_polling() | ||
| + | updater.idle() | ||
| + | </ | ||
| + | |||
| + | ===== HTML ===== | ||
| + | |||
| + | * [[https:// | ||
| + | |||
| + | ===== Emojis ===== | ||
| + | |||
| + | * [[https:// | ||
| + | |||
| + | Se pueden introducir los emojis directamente. En la web oficial de Unicode tienen un [[http:// | ||
| ===== Mensajes ===== | ===== Mensajes ===== | ||
| - | Los mensajes que se reciben mediante Telegram, este módulo los encapsula en un objeto de tipo '' | + | Los mensajes que se reciben mediante Telegram, este módulo los encapsula en un objeto de tipo [[https:// |
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| ==== Texto ==== | ==== Texto ==== | ||
| Línea 98: | Línea 141: | ||
| ' | ' | ||
| ' | ' | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== Vídeos ==== | ||
| + | |||
| + | < | ||
| + | { | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | }, | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | }, | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | }, | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| } | } | ||
| } | } | ||
| </ | </ | ||
informatica/programacion/python/modulos/python-telegram-bot.1613303384.txt.gz · Última modificación: por tempwin
