components.types Module

This module contains the classes MessageType and UpdateType.

class components.types.MessageType

Bases: object

This object represents message types relevant for the AkaNamen Bot.

ALL_TYPES = ['text', 'photo', 'location']

All relevant types

Type

List[str]

LOCATION: str = 'location'

Location messages

Type

str

PHOTO: str = 'photo'

Foto messages

Type

str

TEXT: str = 'text'

Text messages

Type

str

classmethod relevant_type(entity)

Extracts the type of the message, if it is relevant for the AkaNamen Bot in terms of All_TYPES. If it’s not relevant, the output will be None.

Note

In contrast to telegram.utils.helpers.effective_message_type() , only updates with update.message are considered.

Parameters

entity (Union[Update, Message]) – A telegram.Update or telegram.Message

Return type

Optional[str]

class components.types.UpdateType

Bases: object

This object represents update types relevant for the AkaNamen Bot.

ALL_TYPES = ['message', 'inline_query', 'chosen_inline_result', 'callback_query', 'poll', 'poll_answer']

All relevant types

Type

List[str]

CALLBACK_QUERY: str = 'callback_query'

Callback query updates

Type

str

CHOSEN_INLINE_RESULT: str = 'chosen_inline_result'

Chosen inline result updates

Type

str

INLINE_QUERY: str = 'inline_query'

Inline query updates

Type

str

MESSAGE: str = 'message'

Message updates

Type

str

POLL: str = 'poll'

Poll updates

Type

str

POLL_ANSWER: str = 'poll_answer'

Poll answer updates

Type

str

classmethod relevant_type(update)

Extracts the type of the update, if it is relevant for the AkaNamen Bot in terms of All_TYPES. If it’s not relevant, the output will be None.

Parameters

update (Update) – A telegram.Update

Return type

Optional[str]