sleamdge.group

Module Contents

Classes

ParentType

Enum where members are also (and must be) ints

Parent

ChannelId

Bookmarks

This is instantiated once per BaseSession

Participant

A legacy participant of a legacy group chat.

MUC

A room, a.k.a. a Multi-User Chat.

class sleamdge.group.ParentType[source]

Bases: enum.IntEnum

Enum where members are also (and must be) ints

Initialize self. See help(type(self)) for accurate signature.

GROUP = 1[source]
CLAN = 2[source]
class sleamdge.group.Parent[source]

Bases: NamedTuple

type: ParentType[source]
id: int[source]
class sleamdge.group.ChannelId[source]

Bases: NamedTuple

parent: Parent[source]
channel_id: int[source]
class sleamdge.group.Bookmarks(session)[source]

Bases: slidge.LegacyBookmarks[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 (ChannelId)

Return type:

str

async jid_local_part_to_legacy_id(local_part)[source]
Parameters:

local_part (str)

Return type:

ChannelId

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.

Slidge internals will call this on successful BaseSession.login()

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:
contact: sleamdge.contact.Contact[source]
muc: MUC[source]
session: sleamdge.session.Session[source]
async update_reaction(reaction)[source]
Parameters:

reaction (steam.MessageReaction)

Return type:

None

class sleamdge.group.MUC(session, legacy_id, jid)[source]

Bases: slidge.LegacyMUC[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’s slidge.core.session.BaseSession.

Parameters:
session: sleamdge.session.Session[source]
async get_steam_channel()[source]
Return type:

Union[steam.GroupChannel, steam.ClanChannel]

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]

In here, call self.get_participant(), self.get_participant_by_contact(), of self.get_user_participant() to make an initial list of participants.

async backfill(oldest_message_id=None, oldest_message_date=None)[source]

Override this if the legacy network provide server-side archive. In it, send history messages using self.get_participant().send*, with the archive_only=True kwarg.

You only need to fetch messages older than oldest_message_id.

Parameters:
  • oldest_message_id (Optional[int]) – The oldest message ID already present in the archive

  • oldest_message_date (Optional[datetime.datetime]) – The oldest message date already present in the archive

async available_emojis(legacy_msg_id=None)[source]

Override this to restrict the subset of reactions this recipient can handle.

Returns:

A set of emojis or None if any emoji is allowed

Return type:

set[str]