Skip to content

Commit 223c46f

Browse files
committed
Novo método "ShellBot.setMyCommands" para definição de comandos do bot.
1 parent e1b8e6e commit 223c46f

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

ShellBot.sh

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5153,7 +5153,33 @@ _EOF
51535153

51545154
ShellBot.setMyCommands()
51555155
{
5156-
:
5156+
local jq_obj commands
5157+
5158+
local param=$(getopt --name "$FUNCNAME" \
5159+
--options 'c:' \
5160+
--longoptions 'commands:' \
5161+
-- "$@")
5162+
5163+
eval set -- "$param"
5164+
5165+
while :
5166+
do
5167+
case $1 in
5168+
-c|--commands) commands=$2;;
5169+
--) break;;
5170+
esac
5171+
shift 2
5172+
done
5173+
5174+
[[ $commands ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --commands]"
5175+
5176+
jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} ${commands:+-d commands="$commands"})
5177+
5178+
# Retorno do método
5179+
MethodReturn $jq_obj || MessageError TG $jq_obj
5180+
5181+
# Status
5182+
return $?
51575183
}
51585184

51595185
ShellBot.BotCommand()
@@ -6007,6 +6033,9 @@ _EOF
60076033
ShellBot.sendPoll \
60086034
ShellBot.KeyboardButtonPollType \
60096035
ShellBot.sendDice \
6036+
ShellBot.getMyCommands \
6037+
ShellBot.setMyCommands \
6038+
ShellBot.BotCommand \
60106039
ShellBot.setMessageRules \
60116040
ShellBot.manageRules \
60126041
ShellBot.getUpdates

0 commit comments

Comments
 (0)