Use a group chat for logging

This commit is contained in:
Michael De Roover 2021-03-28 23:17:31 +02:00
parent 025fb615fc
commit 7ba241e1ad
Signed by: vim
GPG Key ID: 075496E232CE04CB
2 changed files with 10 additions and 2 deletions

View File

@ -5,8 +5,16 @@ mkconfig(){
echo "Please get your credentials from https://my.telegram.org."
read -p "App API ID (api_id): " api_id
read -p "App API hash (api_hash): " api_hash
read -p "Do you wish to use a log chat? (y/n): " logrpl
if [ "$logrpl" = "y" ]
then
read -p "Log chat ID (logchat): " logchat
else
logchat="'me'"
fi
echo "api_id = $api_id" >> config.py
echo "api_hash = '$api_hash'" >> config.py
echo "logchat = $logchat" >> config.py
}
# Preliminary sanity checks

View File

@ -83,7 +83,7 @@ async def edit(event):
await msgs.delete()
rpl = "Purge complete! Purged " + str(count) + " messages."
await client.send_message('me', rpl)
await client.send_message(logchat, rpl)
if msg.startswith('.sh'):
if event.is_channel and not event.is_group:
@ -91,7 +91,7 @@ async def edit(event):
rpl = f'Someone attempted to execute a command on a channel.\n'
rpl += f'Message: `{msg}`\n'
rpl += f'Execution aborted.\n'
await client.send_message('me', rpl)
await client.send_message(logchat, rpl)
return
import os