bokkichat.entities.message package

Submodules

bokkichat.entities.message.MediaMessage module

class bokkichat.entities.message.MediaMessage.MediaMessage(sender: bokkichat.entities.Address.Address, receiver: bokkichat.entities.Address.Address, media_type: bokkichat.entities.message.MediaType.MediaType, data: bytes, caption: Optional[str] = '')

Bases: bokkichat.entities.message.Message.Message

Class that defines an interface for media messages. Each media message has a media type, data and caption.

__init__(sender: bokkichat.entities.Address.Address, receiver: bokkichat.entities.Address.Address, media_type: bokkichat.entities.message.MediaType.MediaType, data: bytes, caption: Optional[str] = '')

Initializes the TextMessage object :param sender: The sender of the message :param receiver: The receiver of the message :param media_type: The type of the contained media :param data: The data of the attached media :param caption: The caption attached to the media

static is_media()bool
Returns

Whether or not the message is a media message

make_reply(media_type: Optional[bokkichat.entities.message.MediaType.MediaType] = None, data: Optional[bytes] = None, caption: Optional[str] = None)bokkichat.entities.message.Message.Message

Swaps the sender and receiver of the message :param media_type: The type of the contained media :param data: The data of the attached media :param caption: The caption attached to the media :return: The generated reply

bokkichat.entities.message.MediaType module

class bokkichat.entities.message.MediaType.MediaType(value)

Bases: enum.Enum

Enum that specifies the various types of media that can be sent using MediaMessage objects.

AUDIO = 2
IMAGE = 3
VIDEO = 1

bokkichat.entities.message.Message module

class bokkichat.entities.message.Message.Message(sender: bokkichat.entities.Address.Address, receiver: bokkichat.entities.Address.Address)

Bases: object

Class that defines common attributes for a Message object.

__init__(sender: bokkichat.entities.Address.Address, receiver: bokkichat.entities.Address.Address)

Initializes a Message object. :param sender: The sender of the message :param receiver: The receiver of the message

static is_media()bool
Returns

Whether or not the message is a media message

static is_text()bool
Returns

Whether or not the message is a text message

make_reply()bokkichat.entities.message.Message.Message

Swaps the sender and receiver of the message :return: The generated reply

bokkichat.entities.message.TextMessage module

class bokkichat.entities.message.TextMessage.TextMessage(sender: bokkichat.entities.Address.Address, receiver: bokkichat.entities.Address.Address, body: str, title: Optional[str] = '')

Bases: bokkichat.entities.message.Message.Message

Class that defines an interface for text messages. Each text message has a title and a body. Some chat services don’t allow titles for messages, in those cases, the title will be blank.

__init__(sender: bokkichat.entities.Address.Address, receiver: bokkichat.entities.Address.Address, body: str, title: Optional[str] = '')

Initializes the TextMessage object :param sender: The sender of the message :param receiver: The receiver of the message :param body: The message body :param title: The title of the message. Defaults to an empty string

static is_text()bool
Returns

Whether or not the message is a text message

make_reply(body: Optional[str] = None, title: Optional[str] = None)bokkichat.entities.message.Message.Message

Swaps the sender and receiver of the message :return: The generated reply

split(max_chars: int)List[str]

Splits the body text into multiple chunks below a certain size. Will try to not break up any lines :param max_chars: The chunk size :return: The parts of the message

Module contents