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, disable_web_page_preview=False, files=None, images=None, captions=None, locations=None, timeout=30)

Send data over Telegram. All arguments are optional.

Always use this function with explicit keyword arguments. So send(messages=["Hello!"]) instead of send(["Hello!"]) as the latter will break when I change the order of the arguments.

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

  • conf (str): Path of configuration file to use. Will use the default config if not specified. ~ expands to user's home directory.
  • messages (List[str]): The messages to send.
  • parse_mode (str): Specifies formatting of messages, one of ["text", "markdown", "html"].
  • disable_web_page_preview (bool): Disables web page previews for all links in the messages.
  • files (List[file]): The files to send.
  • images (List[file]): The images to send.
  • captions (List[str]): The captions to send with the images.
  • locations (List[str]): The locations to send. Locations are strings containing the latitude and longitude separated by whitespace or a comma.
  • timeout (int|float): The read timeout for network connections in seconds.