slidge.plugins.whatsapp.group
#
Module Contents#
Classes#
Abstract base class for generic types. |
|
Abstract base class for generic types. |
- class slidge.plugins.whatsapp.group.Participant(muc, nickname=None, is_user=False, is_system=False)[source]#
Bases:
slidge.core.muc.LegacyParticipant
- Parameters:
muc (slidge.core.muc.room.LegacyMUC) –
nickname (Optional[str]) –
- send_text(body, legacy_msg_id, **kw)[source]#
Transmit a message from the entity to the user
- Parameters:
body – Content of the message
legacy_msg_id – If you want to be able to transport read markers from the gateway user to the legacy network, specify this
when – when the message was sent, for a “delay” tag (XEP-0203)
reply_to – Quote another message (XEP-0461)
hints –
thread –
carbon – (only in 1:1) Reflect a message sent to this
Contact
by the user. Use this to synchronize outgoing history for legacy official apps.correction – whether this message is a correction or not
archive_only – (only in groups) Do not send this message to user, but store it in the archive. Meant to be used during
MUC.backfill()
- async send_file(file_path, legacy_msg_id, **kw)[source]#
Send a message with an attachment
- Parameters:
file_path – Path to the attachment
data_stream – Alternatively, a stream of bytes (such as a File object)
data – Alternatively, a bytes object
file_url – Alternatively, a URL
file_name – How the file should be named.
content_type – MIME type, inferred from filename if not given
legacy_msg_id – If you want to be able to transport read markers from the gateway user to the legacy network, specify this
reply_to – Quote another message (XEP-0461)
when – when the file was sent, for a “delay” tag (XEP-0203)
caption – an optional text that is linked to the file
legacy_file_id – A unique identifier for the file on the legacy network. Plugins should try their best to provide it, to avoid duplicates.
thread –
- class slidge.plugins.whatsapp.group.MUC(*a, **kw)[source]#
Bases:
slidge.core.muc.LegacyMUC
[str
,str
,Participant
,str
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- class slidge.plugins.whatsapp.group.Bookmarks(session)[source]#
Bases:
slidge.core.muc.LegacyBookmarks
[str
,MUC
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- Parameters:
session (slidge.plugins.whatsapp.session.Session) –
- async fill()[source]#
Establish a user’s known groups.
This has to be overridden in plugins with group support and at the minimum, this should
await self.by_legacy_id(group_id)
for all the groups a user is part of.Ideally, set the group subject, friendly, number, etc. in this method
Slidge internals will call this on successful
BaseSession.login()