Status

class ehforwarderbot.EFBStatus[source]

Abstract class of a status

destination_channel

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

Type

EFBChannel

class ehforwarderbot.status.EFBChatUpdates(channel: EFBChannel, new_chats: Optional[Collection[str]]=tuple(), removed_chats: Optional[Collection[str]]=tuple(), modified_chats: Optional[Collection[str]]=tuple())[source]

Inform the master channel on updates of slave chats.

channel

Slave channel that issues the update

Type

EFBChannel

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: EFBChannel, new_chats: Collection[str]=tuple(), removed_chats: Collection[str]=tuple(), modified_chats: Collection[str]=tuple())[source]
Parameters
  • channel (EFBChannel) – 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.EFBMemberUpdates(channel: EFBChannel, chat_id: str, new_members: Optional[Collection[str]]=tuple(), removed_members: Optional[Collection[str]]=tuple(), modified_members: Optional[Collection[str]]=tuple())[source]

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

channel

Slave channel that issues the update

Type

EFBChannel

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: EFBChannel, chat_id: str, new_members: Collection[str]=tuple(), removed_members: Collection[str]=tuple(), modified_members: Optional[Collection[str]]=tuple())[source]
Parameters
  • channel (EFBChannel) – 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.EFBMessageRemoval(source_channel: EFBChannel, destination_channel: EFBChannel, message: EFBMsg)[source]

Inform a channel to remove a certain message.

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

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

Feedback by sending another EFBMessageRemoval 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

EFBChannel

destination_channel

Channel the status is issued to

Type

EFBChannel

message

Message to remove. This may not be a complete EFBMsg object.

Type

EFBMsg

Raises

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

__init__(source_channel: EFBChannel, destination_channel: EFBChannel, message: EFBMsg)[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 (EFBChannel) – Channel issued the status

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

  • message (EFBMsg) – Message to remove.

class ehforwarderbot.status.EFBReactToMessage(chat: EFBChat, msg_id: str, reaction: Optional[NewType.<locals>.new_type])[source]

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

When this status is sent, a status.EFBMessageReactionsUpdate is recommended to be issued back to master channel.

Parameters
  • chat (EFBChat) – 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 (EFBChannel) – Channel the status is issued to, extracted from the chat object.

Raises
__init__(chat: EFBChat, msg_id: str, reaction: Optional[NewType.<locals>.new_type])[source]
Parameters
  • chat (EFBChat) – 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

class ehforwarderbot.status.EFBMessageReactionsUpdate(chat: EFBChat, msg_id: NewType.<locals>.new_type, reactions: Mapping[NewType.<locals>.new_type, Collection[EFBChat]])[source]

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

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

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

  • reactions (Dict[str, Collection[EFBChat]]) – 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 EFBChat objects in this dict must be of a user or a group member.

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

__init__(chat: EFBChat, msg_id: NewType.<locals>.new_type, reactions: Mapping[NewType.<locals>.new_type, Collection[EFBChat]])[source]
Parameters
  • chat (EFBChat) – The chat where message is sent

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

  • reactions (Dict[str, Collection[EFBChat]]) – 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 EFBChat objects in this dict must be of a user or a group member.