Status

class ehforwarderbot.status.Status[source]

Abstract class of a status

destination_channel

The channel that this status is sent to, usually the master channel.

Type

Channel

class ehforwarderbot.status.ChatUpdates(channel, new_chats=(), removed_chats=(), modified_chats=())[source]

Inform the master channel on updates of slave chats.

channel

Slave channel that issues the update

Type

SlaveChannel

new_chats

Unique ID of new chats

Type

Optional[Collection[str]]

removed_chats

Unique ID of removed chats

Type

Optional[Collection[str]]

modified_chats

Unique ID of modified chats

Type

Optional[Collection[str]]

__init__(channel, new_chats=(), removed_chats=(), modified_chats=())[source]
Parameters
  • channel (SlaveChannel) – Slave channel that issues the update

  • new_chats (Optional[Collection[str]]) – Unique ID of new chats

  • removed_chats (Optional[Collection[str]]) – Unique ID of removed chats

  • modified_chats (Optional[Collection[str]]) – Unique ID of modified chats

class ehforwarderbot.status.MemberUpdates(channel, chat_id, new_members=(), removed_members=(), modified_members=())[source]

Inform the master channel on updates of members in a slave chat.

channel

Slave channel that issues the update

Type

SlaveChannel

chat_id

Unique ID of the chat.

Type

str

new_members

Unique ID of new members

Type

Optional[Collection[str]]

removed_members

Unique ID of removed members

Type

Optional[Collection[str]]

modified_members

Unique ID of modified members

Type

Optional[Collection[str]]

__init__(channel, chat_id, new_members=(), removed_members=(), modified_members=())[source]
Parameters
  • channel (SlaveChannel) – Slave channel that issues the update

  • chat_id (str) – Unique ID of the chat.

  • new_members (Optional[Collection[str]]) – Unique ID of new members

  • removed_members (Optional[Collection[str]]) – Unique ID of removed members

  • modified_members (Optional[Collection[str]]) – Unique ID of modified members

class ehforwarderbot.status.MessageRemoval(source_channel, destination_channel, message)[source]

Inform a channel to remove a certain message.

This is usually known as “delete from everyone”, “delete from recipient”, “recall a message”, “unsend”, or “revoke a message” as well, depends on the IM platform.

Some channels MAY not support removal of messages, and raises a exceptions.EFBOperationNotSupported exception.

Feedback by sending another MessageRemoval back is not required when this object is sent from a master channel. Master channels SHOULD treat a successful delivery of this status as a successful removal.

source_channel

Channel issued the status

Type

Channel

destination_channel

Channel the status is issued to

Type

Channel

message

Message to remove. This MAY not be a complete message.Message object.

Type

Message

Raises

exceptions.EFBOperationNotSupported – When message removal is not supported in the channel.

__init__(source_channel, destination_channel, message)[source]

Create a message removal status

Try to provided as much as you can, if not, provide a minimum information in the channel:

Parameters
  • source_channel (Channel) – Channel issued the status

  • destination_channel (Channel) – Channel the status is issued to

  • message (Message) – Message to remove.

class ehforwarderbot.status.ReactToMessage(chat, msg_id, reaction)[source]

Created when user react to a message, issued from master channel.

When this status is sent, a status.MessageReactionsUpdate is RECOMMENDED to be issued back to master channel.

Parameters
  • chat (Chat) – The chat where message is sent

  • msg_id (str) – ID of the message to react to

  • reaction (Optional[str]) – The reaction name to be sent, usually an emoji. Set to None to remove reaction.

  • destination_channel (SlaveChannel) – Channel the status is issued to, extracted from the chat object.

Raises
__init__(chat, msg_id, reaction)[source]
Parameters
  • chat (Chat) – The chat where message is sent

  • msg_id (str) – ID of the message to react to

  • reaction (Optional[NewType()(ReactionName, str)]) – The reaction name to be sent, usually an emoji

class ehforwarderbot.status.MessageReactionsUpdate(chat, msg_id, reactions)[source]

Update reacts of a message, issued from slave channel to master channel.

Parameters
  • chat (Chat) – The chat where message is sent

  • msg_id (str) – ID of the message for the reacts

  • reactions (Mapping[NewType()(ReactionName, str), Collection[ChatMember]]) – Indicate reactions to the message. Dictionary key represents the reaction name, usually an emoji. Value is a collection of users who reacted to the message with that certain emoji. All Chat objects in this dict MUST be members in the chat of the message.

  • destination_channel (MasterChannel) – Channel the status is issued to, which is always the master channel.

__init__(chat, msg_id, reactions)[source]
Parameters
  • chat (Chat) – The chat where message is sent

  • msg_id (str) – ID of the message for the reacts

  • reactions (Mapping[NewType()(ReactionName, str), Collection[ChatMember]]) – Indicate reactions to the message. Dictionary key represents the reaction name, usually an emoji. Value is a collection of users who reacted to the message with that certain emoji. All Chat objects in this dict MUST be members in the chat of the message.