MCPcopy Create free account
hub / github.com/chatmail/core / add_contact

Method add_contact

python/src/deltachat/chat.py:377–394  ·  view source on GitHub ↗

add a contact to this chat. :params obj: Contact, Account or e-mail address. :raises ValueError: if contact could not be added :returns: None

(self, obj)

Source from the content-addressed store, hash-verified

375 # ------ group management API ------------------------------
376
377 def add_contact(self, obj):
378 """add a contact to this chat.
379
380 :params obj: Contact, Account or e-mail address.
381 :raises ValueError: if contact could not be added
382 :returns: None
383 """
384 from .contact import Contact
385
386 if isinstance(obj, Contact):
387 contact = obj
388 else:
389 contact = self.account.create_contact(obj)
390
391 ret = lib.dc_add_contact_to_chat(self.account._dc_context, self.id, contact.id)
392 if ret != 1:
393 raise ValueError(f"could not add contact {contact!r} to chat")
394 return contact
395
396 def remove_contact(self, obj):
397 """remove a contact from this chat.

Calls 1

create_contactMethod · 0.45