1
0
mirror of https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks.git synced 2025-09-09 07:30:57 +02:00

support channel_post

posts to channels are of the type "channel_post": https://core.telegram.org/bots/api#getting-updates

This MR supports channel posts and should fix problems like #1368 and #1364
This commit is contained in:
Matthias Pfefferle
2020-05-28 00:43:17 +02:00
parent 4a64c490d6
commit d3fa21dffc

View File

@@ -94,13 +94,15 @@ main() {
messageAttr="message"
messageVal=$(echo "$json" | $JQ -r '.result[0].message // ""')
[ -z "$messageVal" ] && messageAttr="edited_message"
messageVal=$(echo "$json" | $JQ -r '.result[0].edited_message // ""')
[ -z "$messageVal" ] && messageAttr="channel_post"
chatId=$(echo "$json" | $JQ -r ".result[0].$messageAttr.chat.id // \"\"")
updateId=$(echo "$json" | $JQ -r '.result[0].update_id // ""')
if [ "$updateId" != "" ] && [ -z "$chatId" ]; then
markAsRead $updateId
return 0
if [ "$updateId" != "" ] && [ -z "$chatId" ]; then
markAsRead $updateId
return 0
fi;
[ -z "$chatId" ] && return 0 # no new messages
cmd=$(echo "$json" | $JQ -r ".result[0].$messageAttr.text // \"\"")