Skip to content

Commit 903cc2c

Browse files
author
Juliano Santos
committed
Nova função "ShellBot.KeyboardButtonPollType" para criação de objeto de enquete.
1 parent 8ab00ff commit 903cc2c

1 file changed

Lines changed: 39 additions & 8 deletions

File tree

ShellBot.sh

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1698,15 +1698,16 @@ ShellBot.init()
16981698

16991699
ShellBot.KeyboardButton()
17001700
{
1701-
local __text __contact __location __button __line
1701+
local __text __contact __location __button __line __request_poll
17021702

17031703
local __param=$(getopt --name "$FUNCNAME" \
1704-
--options 'b:l:t:c:o:' \
1704+
--options 'b:l:t:c:o:r:' \
17051705
--longoptions 'button:,
17061706
line:,
17071707
text:,
17081708
request_contact:,
1709-
request_location:' \
1709+
request_location:,
1710+
request_poll:' \
17101711
-- "$@")
17111712

17121713
eval set -- "$__param"
@@ -1738,6 +1739,10 @@ ShellBot.init()
17381739
__location=$2
17391740
shift 2
17401741
;;
1742+
-r|--request_poll)
1743+
__request_poll=$2
1744+
shift 2
1745+
;;
17411746
--)
17421747
shift
17431748
break
@@ -1754,11 +1759,12 @@ ShellBot.init()
17541759
printf -v $__button "${!__button#[}"
17551760
printf -v $__button "${!__button%]}"
17561761

1757-
printf -v $__button '%s {"text": "%s", "request_contact": %s, "request_location": %s}' \
1758-
"${!__button:+${!__button},}" \
1759-
"${__text}" \
1760-
"${__contact:-false}" \
1761-
"${__location:-false}"
1762+
printf -v $__button '%s {"text": "%s", "request_contact": %s, "request_location": %s, "request_poll": %s}' \
1763+
"${!__button:+${!__button},}" \
1764+
"${__text}" \
1765+
"${__contact:-false}" \
1766+
"${__location:-false}" \
1767+
"${__request_poll:-\"\"}"
17621768

17631769
printf -v $__button "[${!__button}]"
17641770

@@ -5060,6 +5066,30 @@ _EOF
50605066

50615067
}
50625068

5069+
ShellBot.KeyboardButtonPollType()
5070+
{
5071+
local type
5072+
5073+
local param=$(getopt --name "$FUNCNAME" --options 't:' --longoptions 'type:' -- "$@")
5074+
5075+
eval set -- "$param"
5076+
5077+
while :
5078+
do
5079+
case $1 in
5080+
-t|--type) type=$2;;
5081+
--) shift; break;;
5082+
esac
5083+
shift 2
5084+
done
5085+
5086+
[[ $type ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-t, --type]"
5087+
5088+
printf '{"type": "%s"}' "$type"
5089+
5090+
return 0
5091+
}
5092+
50635093
ShellBot.setMessageRules()
50645094
{
50655095
local action command user_id username chat_id
@@ -5856,6 +5886,7 @@ _EOF
58565886
ShellBot.setChatPermissions \
58575887
ShellBot.setChatAdministratorCustomTitle \
58585888
ShellBot.sendPoll \
5889+
ShellBot.KeyboardButtonPollType \
58595890
ShellBot.setMessageRules \
58605891
ShellBot.manageRules \
58615892
ShellBot.getUpdates

0 commit comments

Comments
 (0)