Status¶
- 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
- __init__(channel, new_chats=(), removed_chats=(), modified_chats=())[source]¶
- Parameters
channel (
SlaveChannel
) – Slave channel that issues the updatenew_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
- __init__(channel, chat_id, new_members=(), removed_members=(), modified_members=())[source]¶
- Parameters
channel (
SlaveChannel
) – Slave channel that issues the updatechat_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.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 sentmsg_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. AllChat
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 sentmsg_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. AllChat
objects in this dict MUST be members in the chat of the message.
- 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.- message¶
Message to remove. This MAY not be a complete
message.Message
object.- Type
- 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:
Slave channel ID and chat ID (
message.chat.module_id
andmessage.chat.uid
)Message unique ID from the slave channel (
message.uid
)
- 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 sentmsg_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
.exceptions.EFBMessageReactionNotPossible – Raised when the reaction is not valid (e.g. the specific reaction is not in the list of possible reactions).
.exceptions.EFBOperationNotSupported – Raised when reaction in any form is not supported to the message at all.