answer inline parse_mode

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2019-05-31 22:20:22 +02:00
parent ffec76a830
commit 4297fc164b
2 changed files with 33 additions and 33 deletions

View File

@ -317,28 +317,28 @@ inline_query_compose composes one response element to to send back.
Currently the following types and arguments are implemented (optional arguments in parenthesis) Currently the following types and arguments are implemented (optional arguments in parenthesis)
``` ```
"article"|"message" title message (markup description) "article"|"message" title message (parse_mode description)
"photo" photo_URL (thumb_URL title description caption) "photo" photo_URL (thumb_URL title description caption parse_mode keyboard)
"gif" photo_URL (thumb_URL title caption) "gif" photo_URL (thumb_URL title caption parse_mode keyboard)
"mpeg4_gif" mpeg_URL (thumb_URL title caption) "mpeg4_gif" mpeg_URL (thumb_URL title caption parse_mode keyboard)
"video" video_URL mime_type thumb_URL title (caption) "video" video_URL mime_type thumb_URL title (caption parse_mode keyboard)
"audio" audio_URL title (caption) "audio" audio_URL title (caption parse_mode keyboard)
"voice" voice_URL title (caption) "voice" voice_URL title (caption parse_mode keyboard)
"document" title document_URL mime_type (caption description) "document" title document_URL mime_type (caption description parse_mode)
"location" latitude longitude title "location" latitude longitude title
"venue" latitude longitude title (adress foursquare) "venue" latitude longitude title (adress foursquare)
"contact" phone first (last thumb) "contact" phone first (last thumb)
"cached_photo" file (title description caption) "cached_photo" file (title description caption parse_mode keyboard)
"cached_gif" file (title caption) "cached_gif" file (title caption parse_mode keyboard)
"cached_mpeg4_gif" file (title caption) "cached_mpeg4_gif" file (title caption parse_mode keyboard)
"cached_sticker" file "cached_sticker" file (keyboard)
"cached_document" title file (description caption) "cached_document" title file (description caption description parse_mode keyboard)
"cached_video" file title (description caption) "cached_video" file title (description caption description parse_mode keyboard)
"cached_voice" file title (caption) "cached_voice" file title (caption parse_mode keyboard)
"cached_audio" file title (caption) "cached_audio" file title (caption parse_mode keyboard)
``` ```
see [InlineQueryResult for more information](https://core.telegram.org/bots/api#inlinequeryresult) about response types and their arguments. see [InlineQueryResult for more information](https://core.telegram.org/bots/api#inlinequeryresult) about response types and their arguments.
@ -792,5 +792,5 @@ The name of your bot is availible as bash variable "$ME", there is no need to ca
#### [Prev Best Practice](5_practice.md) #### [Prev Best Practice](5_practice.md)
#### [Next Notes for Developers](7_develop.md) #### [Next Notes for Developers](7_develop.md)
#### $$VERSION$$ v0.90-rc1-0-g93b4914 #### $$VERSION$$ v0.90-rc1-2-gffec76a

View File

@ -5,7 +5,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.90-rc1-0-g93b4914 #### $$VERSION$$ v0.90-rc1-2-gffec76a
# source from commands.sh to use the inline functions # source from commands.sh to use the inline functions
@ -30,31 +30,31 @@ inline_query_compose(){
case "${2}" in case "${2}" in
# user provided media # user provided media
"article"|"message") # article ID title message (markup decription) "article"|"message") # article ID title message (markup decription)
JSON='{"type":"article","id":"'$ID'","input_message_content": {"message_text":"'$4'"} '$(title2Json "$3" "" "$5" "$6")'}' JSON='{"type":"article","id":"'$ID'","input_message_content": {"message_text":"'$4'"} '$(title2Json "$3" "" "$5" "$6" "$7")'}'
;; ;;
"photo") # photo ID photoURL (thumbURL title description caption) "photo") # photo ID photoURL (thumbURL title description caption)
[ "$4" = "" ] && tumb="$3" [ "$4" = "" ] && tumb="$3"
JSON='{"type":"photo","id":"'$ID'","photo_url":"'$3'","thumb_url":"'$4${tumb}'"'$(title2Json "$5" "$7" "$6")'}' JSON='{"type":"photo","id":"'$ID'","photo_url":"'$3'","thumb_url":"'$4${tumb}'"'$(title2Json "$5" "$7" "$6" "$7" "$8")'}'
;; ;;
"gif") # gif ID photoURL (thumbURL title caption) "gif") # gif ID photoURL (thumbURL title caption)
[ "$4" = "" ] && tumb="$3" [ "$4" = "" ] && tumb="$3"
JSON='{"type":"gif","id":"'$ID'","gif_url":"'$3'", "thumb_url":"'$4${tumb}'"'$(title2Json "$5" "$6")'}' JSON='{"type":"gif","id":"'$ID'","gif_url":"'$3'", "thumb_url":"'$4${tumb}'"'$(title2Json "$5" "$6" "$7" "$8" "$9")'}'
;; ;;
"mpeg4_gif") # mpeg4_gif ID mpegURL (thumbURL title caption) "mpeg4_gif") # mpeg4_gif ID mpegURL (thumbURL title caption)
[ "$4" != "" ] && tumb='","thumb_url":"'$4'"' [ "$4" != "" ] && tumb='","thumb_url":"'$4'"'
JSON='{"type":"mpeg4_gif","id":"'$ID'","mpeg4_url":"'$3'"'${tumb}$(title2Json "$5" "$6")'}' JSON='{"type":"mpeg4_gif","id":"'$ID'","mpeg4_url":"'$3'"'${tumb}$(title2Json "$5" "$6" "" "$7" "$8")'}'
;; ;;
"video") # video ID videoURL mime thumbURL title (caption) "video") # video ID videoURL mime thumbURL title (caption)
JSON='{"type":"video","id":"'$ID'","video_url":"'$3'","mime_type":"'$4'","thumb_url":"'$5'"'$(title2Json "$6" "$7")'}' JSON='{"type":"video","id":"'$ID'","video_url":"'$3'","mime_type":"'$4'","thumb_url":"'$5'"'$(title2Json "$6" "$7" "$8" "$9" "${10}")'}'
;; ;;
"audio") # audio ID audioURL title (caption) "audio") # audio ID audioURL title (caption)
JSON='{"type":"audio","id":"'$ID'","audio_url":"'$3'"'$(title2Json "$4" "$5")'}' JSON='{"type":"audio","id":"'$ID'","audio_url":"'$3'"'$(title2Json "$4" "$5" "" "" "$6")'}'
;; ;;
"voice") # voice ID voiceURL title (caption) "voice") # voice ID voiceURL title (caption)
JSON='{"type":"voice","id":"'$ID'","voice_url":"'$3'"'$(title2Json "$4" "$5")'}' JSON='{"type":"voice","id":"'$ID'","voice_url":"'$3'"'$(title2Json "$4" "$5" "" "" "$6")'}'
;; ;;
"document") # document ID title documentURL mimetype (caption description) "document") # document ID title documentURL mimetype (caption description)
JSON='{"type":"document","id":"'$ID'","document_url":"'$4'","mime_type":"'$5'"'$(title2Json "$3" "$6" "$7")'}' JSON='{"type":"document","id":"'$ID'","document_url":"'$4'","mime_type":"'$5'"'$(title2Json "$3" "$6" "$7" "$8" "$9")'}'
;; ;;
"location") # location ID lat long title "location") # location ID lat long title
JSON='{"type":"location","id":"'$ID'","latitude":"'$3'","longitude":"'$4'","title":"'$5'"}' JSON='{"type":"location","id":"'$ID'","latitude":"'$3'","longitude":"'$4'","title":"'$5'"}'
@ -72,28 +72,28 @@ inline_query_compose(){
# title2Json title caption description markup inlinekeyboard # title2Json title caption description markup inlinekeyboard
# Cached media stored in Telegram server # Cached media stored in Telegram server
"cached_photo") # photo ID file (title description caption) "cached_photo") # photo ID file (title description caption)
JSON='{"type":"photo","id":"'$ID'","photo_file_id":"'$3'"'$(title2Json "$4" "$6" "$5")'}' JSON='{"type":"photo","id":"'$ID'","photo_file_id":"'$3'"'$(title2Json "$4" "$6" "$5" "$7" "$8")'}'
;; ;;
"cached_gif") # gif ID file (title caption) "cached_gif") # gif ID file (title caption)
JSON='{"type":"gif","id":"'$ID'","gif_file_id":"'$3'"'$(title2Json "$4" "$5")'}' JSON='{"type":"gif","id":"'$ID'","gif_file_id":"'$3'"'$(title2Json "$4" "$5" "$6" "$7" "$8" )'}'
;; ;;
"cached_mpeg4_gif") # mpeg ID file (title caption) "cached_mpeg4_gif") # mpeg ID file (title caption)
JSON='{"type":"mpeg4_gif","id":"'$ID'","mpeg4_file_id":"'$3'"'$(title2Json "$4" "$5")'}' JSON='{"type":"mpeg4_gif","id":"'$ID'","mpeg4_file_id":"'$3'"'$(title2Json "$4" "$5" "" "$6" "$7")'}'
;; ;;
"cached_sticker") # sticker ID file "cached_sticker") # sticker ID file
JSON='{"type":"sticker","id":"'$ID'","sticker_file_id":"'$3'"}' JSON='{"type":"sticker","id":"'$ID'","sticker_file_id":"'$3'"}'
;; ;;
"cached_document") # document ID title file (description caption) "cached_document") # document ID title file (description caption)
JSON='{"type":"document","id":"'$ID'","document_file_id":"'$4'"'$(title2Json "$3" "$6" "$5")'}' JSON='{"type":"document","id":"'$ID'","document_file_id":"'$4'"'$(title2Json "$3" "$6" "$5" "$6" "$7")'}'
;; ;;
"cached_video") # video ID file title (description caption) "cached_video") # video ID file title (description caption)
JSON='{"type":"video","id":"'$ID'","video_file_id":"'$3'"'$(title2Json "$4" "$6" "$5")'}' JSON='{"type":"video","id":"'$ID'","video_file_id":"'$3'"'$(title2Json "$4" "$6" "$5" "$7" "$8")'}'
;; ;;
"cached_voice") # voice ID file title (caption) "cached_voice") # voice ID file title (caption)
JSON='{"type":"voice","id":"'$ID'","voice_file_id":"'$3'"'$(title2Json "$4" "$5")'}' JSON='{"type":"voice","id":"'$ID'","voice_file_id":"'$3'"'$(title2Json "$4" "$5" "" "" "$6")'}'
;; ;;
"cached_audio") # audio ID file title (caption) "cached_audio") # audio ID file title (caption)
JSON='{"type":"audio","id":"'$ID'","audio_file_id":"'$3'"'$(title2Json "$4" "$5")'}' JSON='{"type":"audio","id":"'$ID'","audio_file_id":"'$3'"'$(title2Json "$4" "$5" "" "" "$6")'}'
;; ;;
esac esac