MCPcopy Create free account
hub / github.com/ehForwarderBot/ehForwarderBot / SelfChatMember

Class SelfChatMember

ehforwarderbot/chat.py:278–328  ·  view source on GitHub ↗

The User Themself as member of a chat. :class:`.SelfChatMember`\\ s are RECOMMENDED to be created together with a chat object by setting ``with_self`` value to ``True``. The created object is accessible at :attr:`.Chat.self`. The default ID of a :class:`.SelfChatMember` object is

Source from the content-addressed store, hash-verified

276
277
278class SelfChatMember(ChatMember):
279 """The User Themself as member of a chat.
280
281 :class:`.SelfChatMember`\\ s are RECOMMENDED to be created together with a
282 chat object by setting ``with_self`` value to ``True``. The created object
283 is accessible at :attr:`.Chat.self`.
284
285 The default ID of a :class:`.SelfChatMember` object is
286 :attr:`.SelfChatMember.SELF_ID`, and the default name is a translated
287 version of the word “You”.
288
289 You are RECOMMENDED to change the ID of this object if provided by your IM
290 platform, and you MAY change the name or alias of this object depending on
291 your needs.
292
293 Note:
294 ``SelfChatMember`` objects are picklable, thus it is RECOMMENDED
295 to keep any object of its subclass also picklable.
296
297 Attributes:
298 SELF_ID: The default ID of a :class:`.SelfChatMember`.
299 """
300
301 SELF_ID = ChatID("__self__")
302
303 def __init__(self, chat: 'Chat', *,
304 name: str = "", alias: Optional[str] = None, id: ChatID = ChatID(""),
305 uid: ChatID = ChatID(""),
306 vendor_specific: Dict[str, Any] = None, description: str = "",
307 middleware: Optional[Middleware] = None):
308 """
309 Args:
310 chat (:class:`~.chat.Chat`): Chat associated with this member.
311
312 Keyword Args:
313 name (str): Name of the member.
314 alias (Optional[str]): Alternative name of the member, usually set by user.
315 uid (:obj:`.ChatID` (str)):
316 Unique ID of the member. This MUST be unique within the channel.
317 This ID can be the same with a private chat of the same person.
318 description (str):
319 A text description of the member, usually known as “bio”,
320 “description”, “summary” or “introduction” of the member.
321 middleware (:class:`.Middleware`): Initialize this chat as a part
322 of a middleware.
323 """
324 name = name or translator.gettext("You")
325 uid = uid or id or self.SELF_ID
326 super().__init__(chat, name=name, alias=alias, id=id, uid=uid,
327 vendor_specific=vendor_specific, description=description,
328 middleware=middleware)
329
330
331class SystemChatMember(ChatMember):

Callers 1

add_selfMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected