diff options
| author | Maria Lisina <sekoohaka.sarisan@gmail.com> | 2025-03-27 21:48:12 +0300 |
|---|---|---|
| committer | Maria Lisina <sekoohaka.sarisan@gmail.com> | 2025-03-27 21:48:12 +0300 |
| commit | 3c5573e81340f7986d761c76a3a25a5127a1ecdd (patch) | |
| tree | cfde7a54df9dd661cde78cd3878b84d8b9e2d427 | |
| parent | d002e672d3982a286133257487565ea1ea35305a (diff) | |
bot: Verbose bot authentication properly
Signed-off-by: Maria Lisina <sekoohaka.sarisan@gmail.com>
| -rwxr-xr-x | bot.sh | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -322,17 +322,32 @@ curl --get \ if ! jq -e '.' "${cache}/getMe.json" > /dev/null then - log_text="Failed to get the bot information" + log_text="Failed to get bot information" . "${units}/log.sh" exit 1 fi +if [ "$(jq -r '.ok' "${cache}/getMe.json")" != "true" ] +then + error_description="$(jq -r '.description' "${cache}/getMe.json")" + + if [ "${error_description}" != "null" ] + then + log_text="${error_description}" + else + log_text="An unknown error occurred" + fi + + . "${units}/log.sh" + exit 1 +fi + username="$(jq -r '.result.username' "${cache}/getMe.json")" if [ "${username}" = "null" ] then - log_text="Failed to authorize the bot" + log_text="Failed to get bot username" . "${units}/log.sh" exit 1 |
