From 9e89627ae9e195fd9a221bfce1ecc1f730926371 Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Mon, 29 Jun 2020 20:17:23 +0200 Subject: [PATCH] add exmaple welcome message to mycommands --- doc/2_usage.md | 4 ++-- mycommands.sh | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/doc/2_usage.md b/doc/2_usage.md index d80a7b1..fddcafc 100644 --- a/doc/2_usage.md +++ b/doc/2_usage.md @@ -74,7 +74,7 @@ Start or Stop your Bot use the following commands: ./bashbot.sh start ``` ```bash -./bashbot.sh kill +./bashbot.sh stop ``` ### User stats @@ -283,5 +283,5 @@ send_action "${CHAT[ID]}" "action" #### [Prev Create Bot](1_firstbot.md) #### [Next Advanced Usage](3_advanced.md) -#### $$VERSION$$ v0.962-114-g595d21f +#### $$VERSION$$ v0.962-115-g10f0dea diff --git a/mycommands.sh b/mycommands.sh index 3d25cef..673e8ab 100644 --- a/mycommands.sh +++ b/mycommands.sh @@ -8,7 +8,7 @@ # #### if you start to develop your own bot, use the clean version of this file: # #### mycommands.clean # -#### $$VERSION$$ v0.962-114-g595d21f +#### $$VERSION$$ v0.962-115-g10f0dea # # uncomment the following lines to overwrite info and help messages @@ -52,6 +52,10 @@ export SILENCER="no" # export REMOVEKEYBOARD="yes" # export REMOVEKEYBOARD_PRIVATE="yes" +# uncomment if you want to say welcome to new chat members +# export WELCOME_NEWMEMBER="yes" +WELCOME_MSG="Welcome" + # messages for admin only commands NOTADMIN="Sorry, this command is allowed for admin or owner only" NOTBOTADMIN="Sorry, this command is allowed for bot owner only" @@ -126,6 +130,14 @@ else # but if we do, remove /edited_message MESSAGE="${MESSAGE#/* }" ;; + '/_new_chat_member'*) + if [[ -n "${WELCOME_NEWMEMBER}" && "${NEWMEMBER[ISBOT]}" != "true" ]]; then + send_normal_message "${CHAT[ID]}"\ + "${WELCOME_MSG} ${NEWMEMBER[FIRST_NAME]} ${NEWMEMBER[LAST_NAME]} (@${NEWMEMBER[USERNAME]})" + MYSENTID="${BOTSENT[ID]}" + { sleep 5; delete_message "${CHAT[ID]}" "${MYSENTID}"; } & + fi + ;; esac case "${MESSAGE}" in