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

Class ChatMember

ehforwarderbot/chat.py:199–275  ·  view source on GitHub ↗

Member of a chat. Usually indicates a member in a group, or the other participant in a private chat. Chat bots created by the users of the IM platform is also considered as a plain :class:`.ChatMember`. To represent the User Themself, use :class:`.SelfChatMember`. To represent a ch

Source from the content-addressed store, hash-verified

197
198
199class ChatMember(BaseChat):
200 """Member of a chat. Usually indicates a member in a group, or the other
201 participant in a private chat. Chat bots created by the users of the
202 IM platform is also considered as a plain :class:`.ChatMember`.
203
204 To represent the User Themself, use :class:`.SelfChatMember`.
205
206 To represent a chat member that is a part of the system, the slave channel,
207 or a middleware, use :class:`.SystemChatMember`.
208
209 :class:`.ChatMember`\\ s MUST be created with reference of the chat it
210 belongs to. Different objects MUST be created even when the same person
211 appears in different groups or in a private chat.
212
213 :class:`.ChatMember`\\ s are RECOMMENDED to be created using
214 :meth:`.Chat.add_member` method.
215
216 Note:
217 ``ChatMember`` objects are picklable, thus it is RECOMMENDED
218 to keep any object of its subclass also picklable.
219 """
220 def __init__(self, chat: 'Chat', *,
221 name: str = "", alias: Optional[str] = None, uid: ChatID = ChatID(""),
222 id: ChatID = ChatID(""),
223 vendor_specific: Dict[str, Any] = None, description: str = "",
224 middleware: Optional[Middleware] = None):
225 """
226 Args:
227 chat (:class:`~.chat.Chat`): Chat associated with this member.
228
229 Keyword Args:
230 name (str): Name of the member.
231 alias (Optional[str]): Alternative name of the member, usually set by user.
232 uid (:obj:`.ChatID` (str)):
233 Unique ID of the member. This MUST be unique within the channel.
234 This ID can be the same with a private chat of the same person.
235 description (str):
236 A text description of the member, usually known as “bio”,
237 “description”, “summary” or “introduction” of the member.
238 middleware (:class:`.Middleware`): Initialize this chat as a part
239 of a middleware.
240 """
241 if middleware:
242 super().__init__(module_name=middleware.middleware_name, channel_emoji="",
243 module_id=middleware.middleware_id, name=name, alias=alias, id=id, uid=uid,
244 vendor_specific=vendor_specific, description=description)
245 else:
246 super().__init__(module_name=chat.module_name, channel_emoji=chat.channel_emoji,
247 module_id=chat.module_id, name=name, alias=alias, id=id, uid=uid,
248 vendor_specific=vendor_specific, description=description)
249 self.chat: 'Chat' = chat
250
251 def verify(self):
252 super().verify()
253 assert isinstance(self.chat, Chat)
254
255 def __eq__(self, other):
256 return (

Callers 1

add_memberMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected