From a734b5f5ab24ab3e954cde4cebeb263a35cd6142 Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Fri, 10 May 2019 14:56:53 +0200 Subject: [PATCH] inline query loop response --- mycommands.sh | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/mycommands.sh b/mycommands.sh index a43eb60..e911f90 100644 --- a/mycommands.sh +++ b/mycommands.sh @@ -2,7 +2,7 @@ # files: mycommands.sh.dist # copy to mycommands.sh and add all your commands and functions here ... # -#### $$VERSION$$ v0.72-dev-3-g65b32aa +#### $$VERSION$$ v0.72-dev-6-ga51f8ca # # shellcheck disable=SC2154 # shellcheck disable=SC2034 @@ -68,14 +68,25 @@ else "google "*) # search in google images local search="${iQUERY#* }" answer_inline_multi "${iQUERY[ID]}" "$(my_image_search "${search}")" +exit ;; - "photo") + "photo") # manually provide URLs answer_inline_multi "${iQUERY[ID]}" " - $(inline_query_compose "$RANDOM" "photo" "https://avatars0.githubusercontent.com/u/13046303"), - $(inline_query_compose "$RANDOM" "photo" "https://avatars1.githubusercontent.com/u/4593242") + $(inline_query_compose "$RANDOM" "photo" "https://avatars.githubusercontent.com/u/13046303"), + $(inline_query_compose "$RANDOM" "photo" "https://avatars.githubusercontent.com/u/4593242") " ;; + "avatar") # read URLS from array + local sep="" + local avatar=("https://avatars.githubusercontent.com/u/13046303" "https://avatars.githubusercontent.com/u/4593242" "https://avatars.githubusercontent.com/u/102707" "https://avatars.githubusercontent.com/u/6460407") + answer_inline_multi "${iQUERY[ID]}" " + $(for photo in ${avatar[*]} ; do + echo "${sep}"; inline_query_compose "$RANDOM" "photo" "${photo}" "${photo}"; sep="," + done) + " + ;; + "sticker") answer_inline_query "${iQUERY[ID]}" "cached_sticker" "BQADBAAD_QEAAiSFLwABWSYyiuj-g4AC" ;; @@ -90,14 +101,14 @@ else # place your processing functions here + # problem: google returns png :-( # $1 search parameter my_image_search(){ - local image result + local image result sep="" result="$(wget --user-agent 'Mozilla/5.0' -qO - "https://www.google.com/search?q=$1&tbm=isch" | sed 's/