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 15:39] – [HTML] tempwin | informatica:programacion:python:modulos:python-telegram-bot [2021/06/23 11:28] (actual) – [Python: python-telegram-bot] tempwin | ||
|---|---|---|---|
| Línea 5: | Línea 5: | ||
| * [[https:// | * [[https:// | ||
| * [[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 ===== | ===== HTML ===== | ||
| Línea 10: | Línea 39: | ||
| * [[https:// | * [[https:// | ||
| - | <code html> | + | ===== Emojis ===== |
| - | < | + | |
| - | < | + | * [[https://github.com/python-telegram-bot/python-telegram-bot/wiki/Emoji]] |
| - | < | + | |
| - | < | + | Se pueden introducir los emojis directamente. En la web oficial de Unicode tienen un [[http://www.unicode.org/emoji/charts/full-emoji-list.html|listado emojis]]. Basta con copiar lo que aparece en la columna **Browser** y pegarlo en el código |
| - | < | + | |
| - | <a href="http://www.example.com/"> | + | |
| - | <a href=" | + | |
| - | %%< | + | |
| - | < | + | |
| - | < | + | |
| - | </ | + | |
| ===== Mensajes ===== | ===== Mensajes ===== | ||
| Los mensajes que se reciben mediante Telegram, este módulo los encapsula en un objeto de tipo [[https:// | Los mensajes que se reciben mediante Telegram, este módulo los encapsula en un objeto de tipo [[https:// | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| ==== Texto ==== | ==== Texto ==== | ||
| Línea 114: | Línea 141: | ||
| ' | ' | ||
| ' | ' | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== Vídeos ==== | ||
| + | |||
| + | < | ||
| + | { | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | }, | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | }, | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | }, | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| } | } | ||
| } | } | ||
| </ | </ | ||
informatica/programacion/python/modulos/python-telegram-bot.1613313572.txt.gz · Última modificación: por tempwin
