-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
send_* fuctions' return value #190
Comments
for historical reason the return value for send functions are undefined and later on I added the telegram response to allow checking the telegram response. I understand it would be better to return a defined return value, let me think about, but it's hard to enshure that the value is correct in all cases as bash return the value of the last exected command. therefore you always have to check BOTSENT[] values in your script to know what's returned from telegram. nevertheless I'll think about to improve the situation. |
Thinking more about, currently a non zero return value means bashbot think there is something wrong with your arguments or an internal error happend. a zero return value means nothing bad happend "arguments seems ok and sent to telegram". In theory it should work like this: if send_xxx then
# sent to telegram, check telegram response
echo "Telegram response BOTSENT[*]"
else
# not sent to telegram, may be wromng argumrents or internal error
echo "Ups, something wrong"
fi
# or like this
if send_xxx && -n "$[BOTSENT[ERROR]"; then
echo "Sent to telegram, response: BOTSENT[*]"
fi but yes it's not perfect :-) and currntly does not work ... I'll try to imporove it in future |
Hi
Almost all
send_*
and some other functions from sendMessage.sh are returning non-zero values after successfull executionIt breaks
sometest && send_* || handle_error
scenarioI have 2 options to solve it:
|| return 0
to all affected lines:[ -n "${BOTSENT[ERROR]}" ] && processError $ARGS || return 0
[ ! -n "${BOTSENT[ERROR]}" ] ||
The text was updated successfully, but these errors were encountered: