sleamdge.group¶
Classes¶
This is instantiated once per |
|
A legacy participant of a legacy group chat. |
|
A room, a.k.a. a Multi-User Chat. |
Module Contents¶
- class sleamdge.group.Bookmarks(session)[source]¶
Bases:
slidge.LegacyBookmarks
[sleamdge.types.ChannelId
,slidge.LegacyMUC
]This is instantiated once per
BaseSession
- Parameters:
session (slidge.core.session.BaseSession)
- session: sleamdge.session.Session[source]¶
- async by_steam_channel(channel)[source]¶
- Parameters:
channel (Union[steam.GroupChannel, steam.ClanChannel])
- async legacy_id_to_jid_local_part(legacy_id)[source]¶
- Parameters:
legacy_id (sleamdge.types.ChannelId)
- Return type:
- class sleamdge.group.Participant(muc, nickname=None, is_user=False, is_system=False, role='participant', affiliation='member')[source]¶
Bases:
slidge.LegacyParticipant
A legacy participant of a legacy group chat.
- Parameters:
muc (slidge.group.room.LegacyMUC)
nickname (Optional[str])
role (slidge.util.types.MucRole)
affiliation (slidge.util.types.MucAffiliation)
- contact: sleamdge.contact.Contact[source]¶
- session: sleamdge.session.Session[source]¶
- class sleamdge.group.MUC(session, legacy_id, jid)[source]¶
Bases:
slidge.LegacyMUC
[sleamdge.types.ChannelId
,int
,Participant
,int
]A room, a.k.a. a Multi-User Chat.
MUC instances are obtained by calling
slidge.group.bookmarks.LegacyBookmarks()
on the user’sslidge.core.session.BaseSession
.- Parameters:
session (slidge.core.session.BaseSession)
legacy_id (slidge.util.types.LegacyGroupIdType)
jid (slixmpp.JID)
- session: sleamdge.session.Session[source]¶
- async fetch_message(legacy_msg_id)[source]¶
- Parameters:
legacy_msg_id (int)
- Return type:
Union[steam.GroupMessage, steam.ClanMessage]
- 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.
To take advantage of the slidge avatar cache, you can check the .avatar property to retrieve the “legacy file ID” of the cached avatar. If there is no change, you should not call
slidge.core.mixins.avatar.AvatarMixin.set_avatar()
or attempt to modify the :attr:.avatar property.
- async fill_participants()[source]¶
This method should yield the list of all members of this group.
Typically, use
participant = self.get_participant()
, self.get_participant_by_contact(), of self.get_user_participant(), and update their affiliation, hats, etc. before yielding them.- Return type:
AsyncIterator[Participant]
- async backfill(after=None, before=None)[source]¶
Override this if the legacy network provide server-side group archives.
In it, send history messages using
self.get_participant(xxx).send_xxxx
, with thearchive_only=True
kwarg. This is only called once per slidge run for a given group.- Parameters:
after (Optional[slidge.util.types.HoleBound]) – Fetch messages after this one. If
None
, it’s up to you to decide how far you want to go in the archive. If it’s notNone
, it means slidge has some messages in this archive and you should really try to complete it to avoid “holes” in the history of this group.before (Optional[slidge.util.types.HoleBound]) – Fetch messages before this one. If
None
, fetch all messages up to the most recent one