From 62cab32da563eb86bffb70b7957243f96645e353 Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Sat, 5 Dec 2020 14:11:21 +0100 Subject: [PATCH] bottoken starts with bot id --- bashbot.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bashbot.sh b/bashbot.sh index 624309e..56bde6f 100755 --- a/bashbot.sh +++ b/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-6-g59c51af +#### $$VERSION$$ v1.2-8-g04ec4ba # # Exit Codes: # - 0 success (hopefully) @@ -264,20 +264,22 @@ if [ -z "${BOTTOKEN}" ]; then fi fi - # BOTTOKEN format checks if ! check_token "${BOTTOKEN}"; then echo -e "${ORANGE}Warning: your bottoken may incorrect. it should have the following format:${NC}" echo -e "${GREY}123456789${RED}:${GREY}Aa-Zz_0Aa-Zz_1Aa-Zz_2Aa-Zz_3Aa-Zz_4${ORANGE} => ${NC}\c" echo -e "${GREY}8-10 digits${RED}:${GREY}35 alphanumeric characters + '_-'${NC}" echo -e "${ORANGE}Your current token is: '${GREY}^$(cat -ve <<<"${BOTTOKEN//:/${RED}:${GREY}}")${ORANGE}'${NC}" - [[ ! "${BOTTOKEN}" =~ ^[0-9]{8,10}: ]] &&\ + if [[ ! "${BOTTOKEN}" =~ ^[0-9]{8,10}: ]]; then echo -e "${ORANGE}Possible problem in the digits part, len is $(($(wc -c <<<"${BOTTOKEN%:*}")-1))${NC}" + [ -n "$(getConfigKey "botid")" ] && echo -e "${GREY}Did you mean: \"${NC}$(getConfigKey "botid")${GREY}\" ?${NC}" + fi [[ ! "${BOTTOKEN}" =~ :[a-zA-Z0-9_-]{35}$ ]] &&\ echo -e "${ORANGE}Possible problem in the characters part, len is $(($(wc -c <<<"${BOTTOKEN#*:}")-1))${NC}" fi + ################## # here we start with the real stuff BASHBOT_RETRY="" # retry by default