diff --git a/install b/install index c4197c9..e1e6a53 100755 --- a/install +++ b/install @@ -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 diff --git a/ubot.py b/ubot.py index 4773957..aeab187 100755 --- a/ubot.py +++ b/ubot.py @@ -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