aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rwxr-xr-xbot.zsh9
2 files changed, 9 insertions, 3 deletions
diff --git a/README.md b/README.md
index e78bccd..101bfdb 100644
--- a/README.md
+++ b/README.md
@@ -53,7 +53,8 @@ For distribution specific installation commands follow [command-not-found](https
## Deployment
-It is highly recommended to run it with an empty environment to avoid variable conflict: `env -i ./bot.zsh` or `env -i PATH="${PATH}" ./bot.zsh` for Termux.
+Usage: `./bot.zsh [options] [token]`
+
For better performance, it is recommended to use a locally deployed [Telegram Bot API](https://github.com/tdlib/telegram-bot-api) server.
### Available options
diff --git a/bot.zsh b/bot.zsh
index 6f76f24..b6af650 100755
--- a/bot.zsh
+++ b/bot.zsh
@@ -3,8 +3,13 @@
# Copyright (C) 2024-2025 Maria Lisina
# Copyright (C) 2024-2025 Danil Lisin
# SPDX-License-Identifier: Apache-2.0
-#
-# Run this software with `env -i` to avoid variable conflict
+
+if [[ ${__bot_noenv:-0} -eq 0 ]]
+then
+ trap 'wait && exit 0' INT TERM
+ env -i PATH="${PATH}" __bot_noenv=1 "${0}" ${@}
+ exit ${?}
+fi
set -e
umask 77