clarify on local variables

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2019-05-25 17:08:28 +02:00
parent 7bad01b258
commit 64b4055dda
1 changed files with 6 additions and 3 deletions

View File

@ -20,22 +20,25 @@
# all global variables and functions can be used.
# any global variable defined by addons MUST be prefixed by addon name
# funtion local varibales can have an name
EXAMPLE_ME="example"
# register to inline
export BASBOT_EVENT_INLINE["${EXAMPLE_ME}"]="${EXAMPLE_ME}_inline"
# any function defined by addons MUST be prefixed by addon name
# function local variables can have any name, but must be LOCAL
example_inline(){
send_normal_message "${CHAT[ID]}" "Inline query received: ${MESSAGE}"
local msg="${MESSAGE}"
send_normal_message "${CHAT[ID]}" "Inline query received: ${msg}"
}
# register to reply
export BASBOT_EVENT_REPLY["${EXAMPLE_ME}"]="${EXAMPLE_ME}_reply"
# any function defined by addons MUST be prefixed by addon name
# function local variables can have any name, but must be LOCAL
example_reply(){
send_markdown_message "${CHAT[ID]}" "User *${USER[USERNAME]}* replied to message from *${REPLYTO[USERNAME]}*"
local msg="message"
send_markdown_message "${CHAT[ID]}" "User *${USER[USERNAME]}* replied to ${msg} from *${REPLYTO[USERNAME]}*"
}