doc: explain attachment functionality in help message & readme

This commit is contained in:
missytake 2025-04-11 08:14:41 +02:00
parent 94ec3af9e3
commit 5bfa83032c
Signed by: missytake
GPG key ID: 04CC6658320518DF
2 changed files with 21 additions and 4 deletions

View file

@ -16,10 +16,13 @@ it will try to query WKD,
and if that fails keys.openpgp.org,
for a public OpenPGP key belonging to the email address.
Then it will send you a VCard file
Then it will send you a VCard contact
which contains the public key,
so you can initiate an encrypted chat to it.
You can also send a .asc PGP key file to the bot,
and it will send you a VCard contact for it.
With the "/generate-invite" command,
you can also generate an invite link for the bot
so you can publish it.

View file

@ -13,6 +13,9 @@ HELP_MSG = (
"I will fetch it's public PGP key "
"(from WKD and keys.openpgp.org) "
"and send you a contact you can encrypt to."
"\n\n"
"If you send me a public PGP key, "
"you will also get a contact for it."
)
@ -51,7 +54,7 @@ def command(event):
return snapshot.chat.send_file(vcard_path)
def request_key_by_email(email) -> str:
def request_key_by_email(email: str) -> str:
domain = email.split("@")[1]
public_key = request_from_wkd(email, domain)
if not public_key:
@ -62,7 +65,13 @@ def request_key_by_email(email) -> str:
@hooks.on(events.RawEvent)
def cleanup(event):
def catch_events(event):
"""This is called on every raw event and can be used for any kind of event handling.
Unfortunately deltachat-rpc-client doesn't offer high-level events for MSG_DELIVERED or SECUREJOIN_INVITER_PROGRESS
yet, so this needs to be done with raw events.
:param event: the event object
"""
print(event)
if event.kind == EventType.MSG_DELIVERED or event.kind == EventType.MSG_FAILED:
msg = Message(event.account, event.msg_id).get_snapshot()
@ -74,7 +83,11 @@ def cleanup(event):
chat.send_text(HELP_MSG)
def delete_data(msg):
def delete_data(msg: Message):
"""For a message, delete the chat and all contacts which were in it to clean up.
:param msg: a Delta Chat Message snapshot
"""
contacts = msg.chat.get_contacts()
msg.chat.delete()
for member in contacts:
@ -82,6 +95,7 @@ def delete_data(msg):
def main():
"""This is the CLI entry point."""
run_bot_cli(hooks)