mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-11-22 23:45:10 +00:00
fix newmwber first_name last_name
This commit is contained in:
parent
f32833ccf9
commit
5baab14cd2
10
bashbot.sh
10
bashbot.sh
@ -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$$ v0.98-dev-3-ga901cc7
|
#### $$VERSION$$ v0.98-dev-4-gf32833c
|
||||||
#
|
#
|
||||||
# Exit Codes:
|
# Exit Codes:
|
||||||
# - 0 sucess (hopefully)
|
# - 0 sucess (hopefully)
|
||||||
@ -698,10 +698,11 @@ process_message() {
|
|||||||
CHAT[LAST_NAME]="$(JsonDecode "${UPD["result",${num},"message","chat","last_name"]}")"
|
CHAT[LAST_NAME]="$(JsonDecode "${UPD["result",${num},"message","chat","last_name"]}")"
|
||||||
CHAT[FIRST_NAME]="$(JsonDecode "${UPD["result",${num},"message","chat","first_name"]}")"
|
CHAT[FIRST_NAME]="$(JsonDecode "${UPD["result",${num},"message","chat","first_name"]}")"
|
||||||
CHAT[USERNAME]="$(JsonDecode "${UPD["result",${num},"message","chat","username"]}")"
|
CHAT[USERNAME]="$(JsonDecode "${UPD["result",${num},"message","chat","username"]}")"
|
||||||
|
# set real name as username if empty
|
||||||
|
: "${CHAT[USERNAME]:=${CHAT[FIRST_NAME]} ${CHAT[LAST_NAME]}}"
|
||||||
CHAT[TITLE]="$(JsonDecode "${UPD["result",${num},"message","chat","title"]}")"
|
CHAT[TITLE]="$(JsonDecode "${UPD["result",${num},"message","chat","title"]}")"
|
||||||
CHAT[TYPE]="$(JsonDecode "${UPD["result",${num},"message","chat","type"]}")"
|
CHAT[TYPE]="$(JsonDecode "${UPD["result",${num},"message","chat","type"]}")"
|
||||||
CHAT[ALL_ADMIN]="${UPD["result",${num},"message","chat","all_members_are_administrators"]}"
|
CHAT[ALL_ADMIN]="${UPD["result",${num},"message","chat","all_members_are_administrators"]}"
|
||||||
CHAT[ALL_MEMBERS_ARE_ADMINISTRATORS]="${CHAT[ALL_ADMIN]}" # backward compatibility
|
|
||||||
|
|
||||||
# user ID is now parsed when update isreceived
|
# user ID is now parsed when update isreceived
|
||||||
#USER[ID]="${UPD["result",${num},"message","from","id"]}"
|
#USER[ID]="${UPD["result",${num},"message","from","id"]}"
|
||||||
@ -775,10 +776,11 @@ process_message() {
|
|||||||
SERVICE[NEWMEMBER]="${UPD["result",${num},"message","new_chat_member","id"]}"
|
SERVICE[NEWMEMBER]="${UPD["result",${num},"message","new_chat_member","id"]}"
|
||||||
if [ -n "${SERVICE[NEWMEMBER]}" ]; then
|
if [ -n "${SERVICE[NEWMEMBER]}" ]; then
|
||||||
NEWMEMBER[ID]="${SERVICE[NEWMEMBER]}"
|
NEWMEMBER[ID]="${SERVICE[NEWMEMBER]}"
|
||||||
NEWMEMBER[FIRSTNAME]="${UPD["result",${num},"message","new_chat_member","first_name"]}"
|
NEWMEMBER[FIRST_NAME]="${UPD["result",${num},"message","new_chat_member","first_name"]}"
|
||||||
NEWMEMBER[LASTNAME]="${UPD["result",${num},"message","new_chat_member","last_name"]}"
|
NEWMEMBER[LAST_NAME]="${UPD["result",${num},"message","new_chat_member","last_name"]}"
|
||||||
NEWMEMBER[USERNAME]="${UPD["result",${num},"message","new_chat_member","username"]}"
|
NEWMEMBER[USERNAME]="${UPD["result",${num},"message","new_chat_member","username"]}"
|
||||||
NEWMEMBER[ISBOT]="${UPD["result",${num},"message","new_chat_member","is_bot"]}"
|
NEWMEMBER[ISBOT]="${UPD["result",${num},"message","new_chat_member","is_bot"]}"
|
||||||
|
MESSAGE[0]="/new_chat_member ${NEWMEMBER[USERNAME]:=${NEWMEMBER[FIRST_NAME]} ${NEWMEMBER[LAST_NAME]}}"
|
||||||
fi
|
fi
|
||||||
SERVICE[LEFTMEMBER]="${UPD["result",${num},"message","left_chat_member","id"]}"
|
SERVICE[LEFTMEMBER]="${UPD["result",${num},"message","left_chat_member","id"]}"
|
||||||
SERVICE[NEWTILE]="${UPD["result",${num},"message","new_chat_title"]}"
|
SERVICE[NEWTILE]="${UPD["result",${num},"message","new_chat_title"]}"
|
||||||
|
Loading…
Reference in New Issue
Block a user