add /_migrate_group to mycommands.sh example

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2020-12-13 12:44:14 +01:00
parent da7a3f1f21
commit eda77f8b55
3 changed files with 17 additions and 8 deletions

View File

@ -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"

View File

@ -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

View File

@ -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