Skip to content

telegram-text integration

Compare
Choose a tag to compare
@cmd410 cmd410 released this 25 Sep 12:21
· 30 commits to master since this release
e9de8b0

This release implements a simple telegram-text integration.

How it works

  • telegram-text is now an optional dependency, installation can be done with pip install origamibot[telegram-text] for example, or as a separate module of course.
  • instances of telegram_text.base.Element and it's descendants can be passed straight to text and caption parameters of API calls.
  • Appropriate type hints are in place
  • when converting to markup string, takes into account passed parse_mode, if not present sets it to HTML by default.
  • old-style text messages are unaffected
  • if telegram-text is not installed converting function is no-op

Example usage

from origamibot import OrigamiBot
from telegram_text import Bold

token: str = "blahblah"
my_cid: int = 12516745
bot = OrigamiBot(token)
bot.send_message(my_cid, Bold("Bold text message"))