errbot.backends.telegram_messenger module

exception errbot.backends.telegram_messenger.RoomsNotSupportedError(message=None)[source]

Bases: errbot.backends.base.RoomError

__init__(message=None)[source]
class errbot.backends.telegram_messenger.TelegramBackend(config)[source]

Bases: errbot.core.ErrBot

__init__(config)[source]
build_identifier(txtrep)[source]

Convert a textual representation into a TelegramPerson or TelegramRoom.

build_reply(msg, text=None, private=False, threaded=False)[source]
change_presence(status: str = 'online', message: str = '') → None[source]
mode
prefix_groupchat_reply(message, identifier)[source]
query_room(room)[source]

Not supported on Telegram.

Raises:RoomsNotSupportedError
rooms()[source]

Not supported on Telegram.

Raises:RoomsNotSupportedError
send_message(msg)[source]
send_stream_request(identifier, fsource, name='file', size=None, stream_type=None)[source]

Starts a file transfer.

Parameters:
  • identifier -- TelegramPerson or TelegramMUCOccupant Identifier of the Person or Room to send the stream to.
  • fsource -- str, dict or binary data File URL or binary content from a local file. Optionally a dict with binary content plus metadata can be given. See stream_type for more details.
  • name (str) -- str, optional Name of the file. Not sure if this works always.
  • size -- str, optional Size of the file obtained with os.path.getsize. This is only used for debug logging purposes.
  • stream_type --

    str, optional Type of the stream. Choices: 'document', 'photo', 'audio', 'video', 'sticker', 'location'.

    If 'video', a dict is optional as {'content': fsource, 'duration': str}. If 'voice', a dict is optional as {'content': fsource, 'duration': str}. If 'audio', a dict is optional as {'content': fsource, 'duration': str, 'performer': str, 'title': str}.

    For 'location' a dict is mandatory as {'latitude': str, 'longitude': str}. For 'venue': TODO # see: https://core.telegram.org/bots/api#sendvenue

Return stream:

str or Stream If fsource is str will return str, else return Stream.

serve_once()[source]
class errbot.backends.telegram_messenger.TelegramBotFilter[source]

Bases: object

This is a filter for the logging library that filters the "No new updates found." log message generated by telegram.bot.

This is an INFO-level log message that gets logged for every getUpdates() call where there are no new messages, so is way too verbose.

static filter(record)[source]
class errbot.backends.telegram_messenger.TelegramIdentifier(id)[source]

Bases: errbot.backends.base.Identifier

__init__(id)[source]
aclattr
id
class errbot.backends.telegram_messenger.TelegramMUCOccupant(id, room, first_name=None, last_name=None, username=None)[source]

Bases: errbot.backends.telegram_messenger.TelegramPerson, errbot.backends.base.RoomOccupant

This class represents a person inside a MUC.

__init__(id, room, first_name=None, last_name=None, username=None)[source]
room
username
class errbot.backends.telegram_messenger.TelegramPerson(id, first_name=None, last_name=None, username=None)[source]

Bases: errbot.backends.telegram_messenger.TelegramIdentifier, errbot.backends.base.Person

__init__(id, first_name=None, last_name=None, username=None)[source]
client
first_name
fullname
id
last_name
nick
person
username
class errbot.backends.telegram_messenger.TelegramRoom(id, title=None)[source]

Bases: errbot.backends.telegram_messenger.TelegramIdentifier, errbot.backends.base.Room

__init__(id, title=None)[source]
create()[source]
destroy()[source]
exists
id
invite(*args)[source]
join(username: str = None, password: str = None)[source]
joined
leave(reason: str = None)[source]
occupants
title

Return the groupchat title (only applies to groupchats)

topic