telegram_send

configure

configure(conf, channel=False, group=False, fm_integration=False)

Guide user to set up the bot, saves configuration at conf.

Arguments

  • conf (str): Path where to save the configuration file. May contain ~ for user's home.
  • channel (Optional[bool]): Configure a channel.
  • group (Optional[bool]): Configure a group.
  • fm_integration (Optional[bool]): Setup file manager integration.

send

send(messages=None, conf=None, parse_mode=None, files=None, images=None, captions=None)

Send data over Telegram. All arguments are optional.

The file type is the file object returned by the open() function. To send an image/file you open it in binary mode:

import telegram_send

with open("image.jpg", "rb") as f:
    telegram_send.send(images=[f])

Arguments

  • messages (List[str]): The messages to send.
  • conf (str): Path of configuration file to use. Will use the default config if not specified. ~ expands to user's home directory.
  • files (List[file]): The files to send.
  • images (List[file]): The images to send.
  • captions (List[str]): The captions to send with the images.
  • parse_mode (str): Specifies formatting of messages, one of ["text", "markdown", "html"].