mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-11-21 15:15:09 +00:00
offer to check bottoken online on first init
This commit is contained in:
parent
b0281f1f32
commit
40106ee163
0
addons/antiFlood.jssh
Normal file
0
addons/antiFlood.jssh
Normal file
@ -5,7 +5,7 @@
|
||||
#
|
||||
# tested on: ubuntu, opensuse, debian
|
||||
#
|
||||
#### $$VERSION$$ v1.2-1-gd30a700
|
||||
#### $$VERSION$$ v1.2-3-gb0281f1
|
||||
# shellcheck disable=SC2009
|
||||
# shellcheck disable=SC2181
|
||||
|
||||
@ -27,7 +27,7 @@ runcmd="echo Dry run:" # not activated until you edit lines below
|
||||
# Configuration Section
|
||||
|
||||
# edit the next line to fit the user you want to run bashbot, e.g. nobody:
|
||||
runas="nobody"
|
||||
runas="root"
|
||||
|
||||
# uncomment one of the example lines to fit your system
|
||||
# runcmd="su $runas -s /bin/bash -c " # runasuser with *su*
|
||||
|
11
bashbot.sh
11
bashbot.sh
@ -11,7 +11,7 @@
|
||||
# This file is public domain in the USA and all free countries.
|
||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||
#
|
||||
#### $$VERSION$$ v1.2-1-gd30a700
|
||||
#### $$VERSION$$ v1.2-3-gb0281f1
|
||||
#
|
||||
# Exit Codes:
|
||||
# - 0 success (hopefully)
|
||||
@ -1093,6 +1093,15 @@ bot_init() {
|
||||
find . -name '*.jssh*' -exec chmod u+w \{\} +
|
||||
echo "Done."
|
||||
fi
|
||||
# ask to check bottoken online
|
||||
if [ -z "$(getConfigKey "botid")" ]; then
|
||||
echo -e "Seems to be your first init. Should I verify your bot token online? (y/N) N\b\c"
|
||||
read -r ANSWER
|
||||
if [[ "${ANSWER}" =~ ^[Yy] ]]; then
|
||||
echo -e "${GREEN}Contacting telegram to verify your bot token ...${NC}"
|
||||
$0 botname
|
||||
fi
|
||||
fi
|
||||
# check if botconf if seems valid
|
||||
echo -e "${GREEN}This is your bot config:${NC}"
|
||||
sed 's/^/\t/' "${BOTCONFIG}.jssh" | grep -vF '["bot_config_key"]'
|
||||
|
Loading…
Reference in New Issue
Block a user