mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-11-11 11:50:54 +00:00
add /_migrate_group to mycommands.sh example
This commit is contained in:
parent
da7a3f1f21
commit
eda77f8b55
@ -11,7 +11,7 @@
|
|||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ v1.2-dev2-4-g22741d9
|
#### $$VERSION$$ v1.2-dev2-5-gda7a3f1
|
||||||
#
|
#
|
||||||
# Exit Codes:
|
# Exit Codes:
|
||||||
# - 0 success (hopefully)
|
# - 0 success (hopefully)
|
||||||
@ -971,7 +971,7 @@ process_message() {
|
|||||||
MIGRATE[FROM]="${UPD["result",${num},"message","migrate_from_chat_id"]}"
|
MIGRATE[FROM]="${UPD["result",${num},"message","migrate_from_chat_id"]}"
|
||||||
SERVICE[MIGRATE]="${MIGRATE[FROM]} ${MIGRATE[TO]}"
|
SERVICE[MIGRATE]="${MIGRATE[FROM]} ${MIGRATE[TO]}"
|
||||||
[ -z "${MESSAGE[0]}" ] &&\
|
[ -z "${MESSAGE[0]}" ] &&\
|
||||||
MESSAGE[0]="/_migrate_chat ${SERVICE[MIGRATE]}"
|
MESSAGE[0]="/_migrate_group ${SERVICE[MIGRATE]}"
|
||||||
fi
|
fi
|
||||||
# set SERVICE to yes if a service message was received
|
# set SERVICE to yes if a service message was received
|
||||||
[[ "${SERVICE[*]}" =~ ^[[:blank:]]*$ ]] || SERVICE[0]="yes"
|
[[ "${SERVICE[*]}" =~ ^[[:blank:]]*$ ]] || SERVICE[0]="yes"
|
||||||
|
@ -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[ID]}```: Id of pinned message
|
||||||
* ```${PINNED[MESSAGE]}```: Message text of pinned message
|
* ```${PINNED[MESSAGE]}```: Message text of pinned message
|
||||||
* ```${SERVICE[MIGRATE]}```: Old and new group id
|
* ```${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[FROM]}```: Old group id
|
||||||
* ```${MIGRATE[TO]}```: New group id
|
* ```${MIGRATE[TO]}```: New group id
|
||||||
|
|
||||||
@ -298,5 +298,5 @@ send_action "${CHAT[ID]}" "action"
|
|||||||
#### [Prev Create Bot](1_firstbot.md)
|
#### [Prev Create Bot](1_firstbot.md)
|
||||||
#### [Next Advanced Usage](3_advanced.md)
|
#### [Next Advanced Usage](3_advanced.md)
|
||||||
|
|
||||||
#### $$VERSION$$ v1.2-dev2-4-g22741d9
|
#### $$VERSION$$ v1.2-dev2-5-gda7a3f1
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
# #### mycommands.clean
|
# #### mycommands.clean
|
||||||
#
|
#
|
||||||
# shellcheck disable=SC1117
|
# shellcheck disable=SC1117
|
||||||
#### $$VERSION$$ v1.2-1-gd30a700
|
#### $$VERSION$$ v1.2-dev2-5-gda7a3f1
|
||||||
#
|
#
|
||||||
|
|
||||||
# uncomment the following lines to overwrite info and help messages
|
# uncomment the following lines to overwrite info and help messages
|
||||||
@ -162,6 +162,11 @@ else
|
|||||||
[ -n "${REPORT_LEFTMEMBER}" ] && send_normal_message "$(getConfigKey "botadmin")"\
|
[ -n "${REPORT_LEFTMEMBER}" ] && send_normal_message "$(getConfigKey "botadmin")"\
|
||||||
"Left member: ${CHAT[TITLE]} (${CHAT[ID]}): ${LEFTMEMBER[FIRST_NAME]} ${LEFTMEMBER[LAST_NAME]} (@${LEFTMEMBER[USERNAME]})"
|
"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
|
esac
|
||||||
|
|
||||||
case "${MESSAGE}" in
|
case "${MESSAGE}" in
|
||||||
@ -173,7 +178,7 @@ else
|
|||||||
'/question'*) # start interactive questions
|
'/question'*) # start interactive questions
|
||||||
checkproc
|
checkproc
|
||||||
if [ "$res" -gt 0 ] ; then
|
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
|
else
|
||||||
send_normal_message "${CHAT[ID]}" "$MESSAGE already running ..."
|
send_normal_message "${CHAT[ID]}" "$MESSAGE already running ..."
|
||||||
fi
|
fi
|
||||||
@ -181,12 +186,16 @@ else
|
|||||||
|
|
||||||
'/cancel'*) # cancel interactive command
|
'/cancel'*) # cancel interactive command
|
||||||
checkproc
|
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
|
'/run_notify'*) # start notify background job
|
||||||
myback="notify"; checkback "$myback"
|
myback="notify"; checkback "$myback"
|
||||||
if [ "$res" -gt 0 ] ; then
|
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
|
else
|
||||||
send_normal_message "${CHAT[ID]}" "Background command $myback already running ..."
|
send_normal_message "${CHAT[ID]}" "Background command $myback already running ..."
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user