slidge.plugins.discord.group
#
Module Contents#
Classes#
Abstract base class for generic types. |
|
Abstract base class for generic types. |
- class slidge.plugins.discord.group.Bookmarks(session)[source]#
Bases:
slidge.LegacyBookmarks
[int
,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.core.session.BaseSession) –
- 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()
- class slidge.plugins.discord.group.Participant(muc, nickname=None, is_user=False, is_system=False)[source]#
Bases:
slidge.plugins.discord.util.StatusMixin
,slidge.plugins.discord.util.MessageMixin
,slidge.LegacyParticipant
- Parameters:
muc (slidge.core.muc.room.LegacyMUC) –
nickname (Optional[str]) –
- class slidge.plugins.discord.group.MUC(session, legacy_id, jid)[source]#
Bases:
slidge.LegacyMUC
[int
,int
,Participant
,int
]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.core.session.BaseSession) –
legacy_id (slidge.util.types.LegacyGroupIdType) –
jid (slixmpp.JID) –
- async get_user_participant()[source]#
Get the participant representing the gateway user
- Parameters:
kwargs – additional parameters for the
Participant
construction (optional)- Returns:
- async fill_participants(max_=50)[source]#
In here, call self.get_participant(), self.get_participant_by_contact(), of self.get_user_participant() to make an initial list of participants.
- async update_info()[source]#
Fetch information about this group from the legacy network
This is awaited on MUC instantiation, and should be overridden to update the attributes of the group chat, like title, subject, number of participants etc.
- async backfill(oldest_id=None, oldest_date=None)[source]#
Override this if the legacy network provide server-side archive. In it, send history messages using
self.get_participant().send*
, with thearchive_only=True
kwarg.You only need to fetch messages older than
oldest_message_id
.- Parameters:
oldest_message_id – The oldest message ID already present in the archive
oldest_message_date – The oldest message date already present in the archive
- async history(oldest=None)[source]#
- Parameters:
oldest (Optional[datetime.datetime]) –