Correct instances of bahsbot to bashbot

This commit is contained in:
dcoomber 2020-09-27 17:36:01 +02:00
parent de7d363abc
commit 9c8b4f9611
9 changed files with 19 additions and 19 deletions

View File

@ -29,7 +29,7 @@
# BASHBOT_EVENT_LOCATION location or venue received # BASHBOT_EVENT_LOCATION location or venue received
# BASHBOT_EVENT_FILE file received # BASHBOT_EVENT_FILE file received
# #
# BAHSBOT_EVENT_TIMER this event is a bit special as it fires every Minute # BASHBOT_EVENT_TIMER this event is a bit special as it fires every Minute
# and has 3 meanings: oneshot, every time, every X minutes. # and has 3 meanings: oneshot, every time, every X minutes.
# #
# all global variables and functions can be used in registered functions. # all global variables and functions can be used in registered functions.

View File

@ -107,8 +107,8 @@ by sourcing it:
*usage:* . bashbot.sh source *usage:* . bashbot.sh source
Before sourcing 'bahsbot.sh' for interactive and script use, you should export and set BASHBOT_HOME to bashbots installation dir, Before sourcing 'bashbot.sh' for interactive and script use, you should export and set BASHBOT_HOME to bashbots installation dir,
e.g. '/usr/local/telegram-bot-bash'. see [Bashbot Environemt](#Bashbot-environment) e.g. '/usr/local/telegram-bot-bash'. see [Bashbot Environment](#Bashbot-environment)
**Note:** *If you don't set BASHBOT_HOME bashbot will use the actual directory as NEW home directory **Note:** *If you don't set BASHBOT_HOME bashbot will use the actual directory as NEW home directory
which means it will create all needed files and ask for bot token and botadmin if you are not in the real bot home!* which means it will create all needed files and ask for bot token and botadmin if you are not in the real bot home!*

View File

@ -15,7 +15,7 @@ To start with a clean/minimal bot copy ```mycommands.sh.clean``` to ```mycommand
the message strings and place commands in the```case ... esac``` block of the function mycommands(): the message strings and place commands in the```case ... esac``` block of the function mycommands():
```bash ```bash
# file: mycommands.sh # file: mycommands.sh
# your additional bahsbot commands # your additional bashbot commands
# uncomment the following lines to overwrite info and help messages # uncomment the following lines to overwrite info and help messages
bashbot_info='This is *MY* variant of _bashbot_, the Telegram bot written entirely in bash. bashbot_info='This is *MY* variant of _bashbot_, the Telegram bot written entirely in bash.

View File

@ -281,7 +281,7 @@ fi
*See also [Chat Member](https://core.telegram.org/bots/api/#chatmember)* *See also [Chat Member](https://core.telegram.org/bots/api/#chatmember)*
##### user_is_allowed ##### user_is_allowed
Bahsbot supports User Access Control, see [Advanced Usage](3_advanced.md) Bashbot supports User Access Control, see [Advanced Usage](3_advanced.md)
*usage:* user_is_allowed "${USER[ID]}" "what" "${CHAT[ID]}" *usage:* user_is_allowed "${USER[ID]}" "what" "${CHAT[ID]}"

View File

@ -31,7 +31,7 @@ you can the change the level of verbosity of the debug argument:
to keep 'bashbot.sh' small, while extending functionality. In addition not every function is needed by all bots, so you can to keep 'bashbot.sh' small, while extending functionality. In addition not every function is needed by all bots, so you can
disable modules, e.g. by rename the respective module file to 'module.sh.off'. disable modules, e.g. by rename the respective module file to 'module.sh.off'.
Modules must use only functions provided by 'bahsbot.sh' or the module itself and should not depend on other modules or addons. Modules must use only functions provided by 'bashbot.sh' or the module itself and should not depend on other modules or addons.
The only mandatory module is 'module/sendMessage.sh'. The only mandatory module is 'module/sendMessage.sh'.
If a not mandatory module is used in 'bashbot.sh' or 'commands.sh', the use of ```_is_function``` or If a not mandatory module is used in 'bashbot.sh' or 'commands.sh', the use of ```_is_function``` or
@ -115,7 +115,7 @@ To avoid wrong use of EVENT_SEND, e.g. fork bomb, event processing is suspended
*Example:* *Example:*
```bash ```bash
# register callback: # register callback:
BAHSBOT_EVENT_SEND["example_log","1"]="example_log" BASHBOT_EVENT_SEND["example_log","1"]="example_log"
EXAMPLE_LOG="${BASHBOT_ETC:-.}/addons/${EXAMPLE_ME}.log" EXAMPLE_LOG="${BASHBOT_ETC:-.}/addons/${EXAMPLE_ME}.log"
# Note: do not call any send message functions from EVENT_SEND! # Note: do not call any send message functions from EVENT_SEND!
@ -130,7 +130,7 @@ example_log(){
Important: Bashbot timer tick is disabled by default and must be enabled by setting BASHBOT_START_TIMER to any value not zero. Important: Bashbot timer tick is disabled by default and must be enabled by setting BASHBOT_START_TIMER to any value not zero.
* BAHSBOT_EVENT_TIMER executed every minute and can be used in 3 variants: oneshot, once a minute, every X minutes. * BASHBOT_EVENT_TIMER executed every minute and can be used in 3 variants: oneshot, once a minute, every X minutes.
Registering to BASHBOT_EVENT_TIMER works similar as for message events, but you must add a timing argument to the name. Registering to BASHBOT_EVENT_TIMER works similar as for message events, but you must add a timing argument to the name.
EVENT_TIMER is triggered every 60s and waits until the current running command is finished, so it's not exactly every EVENT_TIMER is triggered every 60s and waits until the current running command is finished, so it's not exactly every
@ -139,7 +139,7 @@ minute, but once a minute.
Every time EVENT_TIMER is triggered the variable "EVENT_TIMER" is increased. each callback is executed if ```EVENT_TIMER % time``` is '0' (true). Every time EVENT_TIMER is triggered the variable "EVENT_TIMER" is increased. each callback is executed if ```EVENT_TIMER % time``` is '0' (true).
This means if you register an every 5 minutes callback first execution may < 5 Minutes, all subsequent executions are once every 5. Minute. This means if you register an every 5 minutes callback first execution may < 5 Minutes, all subsequent executions are once every 5. Minute.
*usage:* BAHSBOT_EVENT_TIMER[ "name" , "time" ], where time is: *usage:* BASHBOT_EVENT_TIMER[ "name" , "time" ], where time is:
* 0 ignored * 0 ignored
* 1 execute once every minute * 1 execute once every minute
@ -151,7 +151,7 @@ Note: If you want exact "in x minutes" use "EVENT_TIMER plus x" as time: ```-(EV
*Example:* *Example:*
```bash ```bash
# register callback: # register callback:
BAHSBOT_EVENT_TIMER["example_every","1"]="example_everymin" BASHBOT_EVENT_TIMER["example_every","1"]="example_everymin"
# function called every minute # function called every minute
example_everymin() { example_everymin() {
@ -160,13 +160,13 @@ example_everymin() {
} }
# register other callback: # register other callback:
BAHSBOT_EVENT_TIMER["example_every5","5"]="example_every5min" BASHBOT_EVENT_TIMER["example_every5","5"]="example_every5min"
# execute once on the next 10 minutes since start "event" # execute once on the next 10 minutes since start "event"
BAHSBOT_EVENT_TIMER["example_10min","-10"]="example_in10min" BASHBOT_EVENT_TIMER["example_10min","-10"]="example_in10min"
# once in exact 10 minutes # once in exact 10 minutes
BAHSBOT_EVENT_TIMER["example_10min","$(( (EVENT_TIMER+10) * -1 ))"]="example_in10min" BASHBOT_EVENT_TIMER["example_10min","$(( (EVENT_TIMER+10) * -1 ))"]="example_in10min"
``` ```
@ -297,7 +297,7 @@ To create a new test run ```test/ADD-test-new.sh``` and answer the questions, it
Each test consists of a script script named after ```p-name-test.sh``` *(where p is test pass 'a-z' and name the name Each test consists of a script script named after ```p-name-test.sh``` *(where p is test pass 'a-z' and name the name
of your test)* and an optional dir ```p-name-test/``` *(script name minus '.sh')* for additional files. of your test)* and an optional dir ```p-name-test/``` *(script name minus '.sh')* for additional files.
Tests with no dependency to other tests will run in pass 'a', tests which need an initialized bahsbot environment must run in pass 'd' or later. Tests with no dependency to other tests will run in pass 'a', tests which need an initialized bashbot environment must run in pass 'd' or later.
A temporary test environment is created when 'ALL-tests.sh' starts and deleted after all tests are finished. A temporary test environment is created when 'ALL-tests.sh' starts and deleted after all tests are finished.
The file ```ALL-tests.inc.sh``` must be included from all tests and provide the test environment as shell variables: The file ```ALL-tests.inc.sh``` must be included from all tests and provide the test environment as shell variables:

View File

@ -3,7 +3,7 @@
# copy to mycommands.sh and add all your commands an functions here ... # copy to mycommands.sh and add all your commands an functions here ...
export res export res
# your additional bahsbot commands ... # your additional bashbot commands ...
mycommands() { mycommands() {
case "$MESSAGE" in case "$MESSAGE" in

View File

@ -23,8 +23,8 @@ if true; then
else else
# alternative linux like locations # alternative linux like locations
BINDIR="/usr/local/bin" BINDIR="/usr/local/bin"
ETC="/etc/bahsbot" ETC="/etc/bashbot"
VAR="/var/bahsbot" VAR="/var/bashbot"
export BASHBOT_JSONSH="/usr/local/bin/JSON.sh" export BASHBOT_JSONSH="/usr/local/bin/JSON.sh"
fi fi

View File

@ -206,7 +206,7 @@ else
my_startup my_startup
fi fi
# your additional bahsbot commands # your additional bashbot commands
# NOTE: command can have @botname attached, you must add * in case tests... # NOTE: command can have @botname attached, you must add * in case tests...
mycommands() { mycommands() {
# a service Message was received # a service Message was received

View File

@ -32,7 +32,7 @@ bashbot_help='*Available commands*:
' '
# your additional bahsbot commands # your additional bashbot commands
# NOTE: command can have @botname attached, you must add * in case tests... # NOTE: command can have @botname attached, you must add * in case tests...
mycommands() { mycommands() {
local msg="" local msg=""