in the beginning, ui.admin_chat is empty

This commit is contained in:
missytake 2025-08-27 14:09:42 +02:00
parent 02341180b8
commit 7e5f720467
Signed by: missytake
GPG key ID: 04CC6658320518DF
2 changed files with 4 additions and 10 deletions

View file

@ -26,7 +26,10 @@ def set_admin_chat(chat: deltachat.Chat):
def get_admin_chat(account: deltachat.Account) -> deltachat.Chat:
"""Get the current admin chat"""
id = account.get_config("ui.admin_chat")
try:
id = int(account.get_config("ui.admin_chat"))
except ValueError:
id = 1
return account.get_chat_by_id(int(id))

View file

@ -16,15 +16,6 @@ from .commands import (
def loop(ac: deltachat.Account):
admin_chat = get_admin_chat(ac)
while not admin_chat:
for msg in ac.get_fresh_messages():
if msg.text.startswith("/start"):
chat = msg.create_chat()
set_admin_chat(chat)
if msg.text.startswith("/help"):
send_help(msg)
msg.mark_seen()
time.sleep(3)
print(f"Selected {admin_chat.get_name()} as admin chat")
while True:
for msg in ac.get_fresh_messages():