Add support for loading auto-reply from file

This commit is contained in:
Michael De Roover 2023-08-01 01:55:57 +02:00
parent d78c0feac0
commit 95761d9c07
Signed by: vim
GPG Key ID: 075496E232CE04CB
1 changed files with 8 additions and 3 deletions

View File

@ -20,9 +20,14 @@ async def log(event):
f = open(f'/var/telelog/logs/{event.chat_id}')
except IOError:
chat = await event.get_input_chat()
rpl = "This account does not accept private messages. "
rpl += "My userbot will block you now. "
rpl += "Please reach out to me in a common group if applicable. "
import os
if os.path.exists('/var/telelog/autoreply.txt'):
autoreply = open('/var/telelog/autoreply.txt', 'r')
rpl = autoreply.read()
else:
rpl = "This account does not accept private messages. "
rpl += "My userbot will block you now. "
rpl += "Please reach out to me in a common group if applicable. "
await event.respond(rpl)
await client(functions.contacts.BlockRequest(chat))
f = open(f'/var/telelog/logs/{event.chat_id}', "a")