slidgram.group
#
Module Contents#
Classes#
This is instantiated once per |
|
A room, a.k.a. a Multi-User Chat. |
|
A legacy participant of a legacy group chat. |
Attributes#
- exception slidgram.group.NotAMember(status)[source]#
Bases:
slixmpp.exceptions.XMPPError
A generic exception that may be raised while processing an XMPP stanza to indicate that an error response stanza should be sent.
The exception method for stanza objects extending
RootStanza
will create an error stanza and initialize any additional substanzas using the extension information included in the exception.Meant for use in Slixmpp plugins and applications using Slixmpp.
Extension information can be included to add additional XML elements to the generated error stanza.
- Parameters:
condition – The XMPP defined error condition. Defaults to
'undefined-condition'
.text – Human readable text describing the error.
etype – The XMPP error type, such as
'cancel'
or'modify'
. Defaults to'cancel'
.extension – Tag name of the extension’s XML content.
extension_ns – XML namespace of the extensions’ XML content.
extension_args – Content and attributes for the extension element. Same as the additional arguments to the
Element
constructor.clear – Indicates if the stanza’s contents should be removed before replying with an error. Defaults to
True
.status (aiotdlib.api.ChatMemberStatus) –
Initialize self. See help(type(self)) for accurate signature.
- class slidgram.group.Bookmarks(*a, **k)[source]#
Bases:
slidge.LegacyBookmarks
[int
,MUC
]This is instantiated once per
BaseSession
- session: slidgram.session.Session[source]#
- class slidgram.group.MUC(*a, **k)[source]#
Bases:
slidgram.util.AvailableEmojisMixin
,slidge.LegacyMUC
[int
,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
.- session: slidgram.session.Session[source]#
- update_tg_photo(photo)[source]#
- Parameters:
photo (Optional[aiotdlib.api.ChatPhoto]) –
- Return type:
None
- async get_info()[source]#
- Return type:
Union[aiotdlib.api.BasicGroupFullInfo, aiotdlib.api.SupergroupFullInfo]
- async update_info(info=None)[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.- Parameters:
info (Optional[Union[aiotdlib.api.BasicGroupFullInfo, aiotdlib.api.SupergroupFullInfo]]) –
- async fill_participants(info=None)[source]#
In here, call self.get_participant(), self.get_participant_by_contact(), of self.get_user_participant() to make an initial list of participants.
- Parameters:
info (Optional[Union[aiotdlib.api.BasicGroupFullInfo, aiotdlib.api.SupergroupFullInfo]]) –
- async backfill(oldest_message_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 participant_by_sender_id(sender_id)[source]#
- Parameters:
sender_id (aiotdlib.api.MessageSender) –
- async on_set_affiliation(contact, affiliation, reason, nickname)[source]#
Triggered when the user requests changing the affiliation of a contact for this group,
Examples: promotion them to moderator, kick (affiliation=none), ban (affiliation=outcast).
- Parameters:
contact (slidgram.contact.Contact) – The contact whose affiliation change is requested
affiliation (slixmpp.types.MucAffiliation) – The new affiliation
reason (Optional[str]) – A reason for this affiliation change
nickname (Optional[str]) –
- async on_set_config(name, description)[source]#
Triggered when the user requests changing the room configuration. Only title and description can be changed at the moment.
The legacy module is responsible for updating
title
and/ordescription
of this instance.If
HAS_DESCRIPTION
is set to False, description will always beNone
.
- class slidgram.group.Participant(*a, **k)[source]#
Bases:
slidge.LegacyParticipant
,slidgram.util.TelegramToXMPPMixin
A legacy participant of a legacy group chat.
- contact: slidgram.contact.Contact[source]#
- session: slidgram.session.Session[source]#