diff --git a/bashbot.sh b/bashbot.sh index a54bd77..bc964af 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-dev2-4-g22741d9 +#### $$VERSION$$ v1.2-dev2-5-gda7a3f1 # # Exit Codes: # - 0 success (hopefully) @@ -971,7 +971,7 @@ process_message() { MIGRATE[FROM]="${UPD["result",${num},"message","migrate_from_chat_id"]}" SERVICE[MIGRATE]="${MIGRATE[FROM]} ${MIGRATE[TO]}" [ -z "${MESSAGE[0]}" ] &&\ - MESSAGE[0]="/_migrate_chat ${SERVICE[MIGRATE]}" + MESSAGE[0]="/_migrate_group ${SERVICE[MIGRATE]}" fi # set SERVICE to yes if a service message was received [[ "${SERVICE[*]}" =~ ^[[:blank:]]*$ ]] || SERVICE[0]="yes" diff --git a/doc/2_usage.md b/doc/2_usage.md index 13411fa..d4d1cf0 100644 --- a/doc/2_usage.md +++ b/doc/2_usage.md @@ -191,7 +191,7 @@ e.g. if a new user joins a chat MESSAGE is set to "/_new_chat_user". * ```${PINNED[ID]}```: Id of pinned message * ```${PINNED[MESSAGE]}```: Message text of pinned message * ```${SERVICE[MIGRATE]}```: Old and new group id - * ```${MESSAGE}```: /_migrate_chat MIGRATE_FROM MIGRATE_TO + * ```${MESSAGE}```: /_migrate_group MIGRATE_FROM MIGRATE_TO * ```${MIGRATE[FROM]}```: Old group id * ```${MIGRATE[TO]}```: New group id @@ -298,5 +298,5 @@ send_action "${CHAT[ID]}" "action" #### [Prev Create Bot](1_firstbot.md) #### [Next Advanced Usage](3_advanced.md) -#### $$VERSION$$ v1.2-dev2-4-g22741d9 +#### $$VERSION$$ v1.2-dev2-5-gda7a3f1 diff --git a/mycommands.sh b/mycommands.sh index 236e717..b4778f8 100644 --- a/mycommands.sh +++ b/mycommands.sh @@ -9,7 +9,7 @@ # #### mycommands.clean # # shellcheck disable=SC1117 -#### $$VERSION$$ v1.2-1-gd30a700 +#### $$VERSION$$ v1.2-dev2-5-gda7a3f1 # # uncomment the following lines to overwrite info and help messages @@ -162,6 +162,11 @@ else [ -n "${REPORT_LEFTMEMBER}" ] && send_normal_message "$(getConfigKey "botadmin")"\ "Left member: ${CHAT[TITLE]} (${CHAT[ID]}): ${LEFTMEMBER[FIRST_NAME]} ${LEFTMEMBER[LAST_NAME]} (@${LEFTMEMBER[USERNAME]})" ;; + '/_migrate_group'*) + # call group migration function if provided + _exec_if_function my_migrate_group "${MIGRATE[FROM]}" "${MIGRATE[TO]}" + ;; + esac case "${MESSAGE}" in @@ -173,7 +178,7 @@ else '/question'*) # start interactive questions checkproc if [ "$res" -gt 0 ] ; then - startproc "examples/question.sh" || _message "Can't start question." + startproc "examples/question.sh" || send_normal_message "${CHAT[ID]}" "Can't start question." else send_normal_message "${CHAT[ID]}" "$MESSAGE already running ..." fi @@ -181,12 +186,16 @@ else '/cancel'*) # cancel interactive command checkproc - if [ "$res" -gt 0 ] ;then killproc && _message "Command canceled.";else _message "No command is currently running.";fi + if [ "$res" -gt 0 ] ;then + killproc && send_normal_message "${CHAT[ID]}" "Command canceled." + else + send_normal_message "${CHAT[ID]}" "No command is currently running." + fi ;; '/run_notify'*) # start notify background job myback="notify"; checkback "$myback" if [ "$res" -gt 0 ] ; then - background "examples/notify.sh 60" "$myback" || _message "Can't start notify." + background "examples/notify.sh 60" "$myback" || send_normal_message "${CHAT[ID]}" "Can't start notify." else send_normal_message "${CHAT[ID]}" "Background command $myback already running ..." fi