remove messages from device after 1 day

This commit is contained in:
missytake 2023-05-22 15:34:10 +02:00
parent 212c0abf71
commit 2ad1a3b0cd

View file

@ -46,9 +46,13 @@ def init(ctx, db_path, from_backup) -> None:
"You need to enable 'Send Copy to Self' in the Advanced settings for this bot to work." "You need to enable 'Send Copy to Self' in the Advanced settings for this bot to work."
) )
# some config defaults; see https://c.delta.chat/classdc__context__t.html#aff3b894f6cfca46cab5248fdffdf083d
ac.set_config("bot", "1")
# disable read receipts; we don't want the bot to send out read receipts if the actual account # disable read receipts; we don't want the bot to send out read receipts if the actual account
# owner didn't read the message yet # owner didn't read the message yet
ac.set_config("mdns_enabled", "0") ac.set_config("mdns_enabled", "0")
# delete from device after 1 day to save disk space
ac.set_config("delete_device_after", "86400")
# create control group # create control group
if not get_control_group(ac): if not get_control_group(ac):
@ -89,7 +93,9 @@ def process_command(
try: try:
qr = ac.check_qr(command.text) qr = ac.check_qr(command.text)
if qr._dc_lot.state() == 512: if qr._dc_lot.state() == 512:
dclib.dc_set_config_from_qr(ac._dc_context, as_dc_charpointer(command.text)) dclib.dc_set_config_from_qr(
ac._dc_context, as_dc_charpointer(command.text)
)
replytext = str(qr._dc_lot.state()) + ". scanned " + command.text replytext = str(qr._dc_lot.state()) + ". scanned " + command.text
except ValueError: except ValueError:
replytext = "Not a valid OPENPGP4FPR code" replytext = "Not a valid OPENPGP4FPR code"