mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-06-04 19:30:52 +00:00
modules: send_dice: accept more formats, allow false reply_to
This commit is contained in:
parent
2f6f3bd4d8
commit
a9ed559383
|
@ -6,7 +6,7 @@
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
#
|
#
|
||||||
# shellcheck disable=SC1117
|
# shellcheck disable=SC1117
|
||||||
#### $$VERSION$$ v1.45-dev-4-g52d1ac5
|
#### $$VERSION$$ v1.45-dev-6-g2f6f3bd
|
||||||
|
|
||||||
# will be automatically sourced from bashbot
|
# will be automatically sourced from bashbot
|
||||||
|
|
||||||
|
@ -317,22 +317,22 @@ send_action() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1 chat $2 emoji “🎲”, “🎯”, “🏀”, “⚽”, “🎰"
|
# $1 chat $2 emoji “🎲”, “🎯”, “🏀”, “⚽”, “🎰"
|
||||||
# code: \u201c\ud83c\udfb2\u201d \u201c\ud83c\udfaf\u201d \u201c\ud83c\udfc0\u201d \u201c\u26bd\u201d \u201c\ud83c\udfb0\u201d
|
# code: "\ud83c\udfb2" "\ud83c\udfaf" "\ud83c\udfc0" "\u26bd" "\ud83c\udfb0"
|
||||||
# text: ":game_die:" "game" ":dart:" "dart" ":basketball:" "basket" ":soccer:" "soccer" :slot_machine:" "slot"
|
# text: ":game_die:" ":dart:" ":basketball:" ":soccer:" :slot_machine:"
|
||||||
# $3 reply_to_id
|
# $3 reply_to_id
|
||||||
send_dice() {
|
send_dice() {
|
||||||
local emoji reply
|
local emoji reply
|
||||||
[ -n "$3" ] && reply=',"reply_to_message_id":'"$3"
|
[[ "$3" =~ ^[${o9o9o9}-]+$ ]] && reply=',"reply_to_message_id":'"$3"',"allow_sending_without_reply": true'
|
||||||
case "$2" in # must be single character
|
case "$2" in # convert input to single character emoji
|
||||||
*🎲*|*game*) emoji='\u201c\ud83c\udfb2\u201d' ;;
|
*🎲*|*game* |*'dfb2'*|*'DFB2'*) emoji='\ud83c\udfb2' ;;
|
||||||
*🎯*|*dart*) emoji='\u201c\ud83c\udfaf\u201d' ;;
|
*🎯*|*dart* |*'dfaf'*|*'DFAF'*) emoji='\ud83c\udfaf' ;;
|
||||||
*🏀*|*basket*) emoji='\u201c\ud83c\udfc0\u201d' ;;
|
*🏀*|*basket*|*'dfc0'*|*'DFC0'*) emoji='\ud83c\udfc0' ;;
|
||||||
*⚽*|*soccer*) emoji='\u201c\u26bd\u201d' ;;
|
*⚽*|*soccer*|*'26bd'*|*'26BD'*) emoji='\u26bd' ;;
|
||||||
*🎰*|*slot*) emoji='\u201c\ud83c\udfb0\u201d' ;;
|
*🎰*|*slot* |*'dfb0'*|*'DFB0'*) emoji='\ud83c\udfb0' ;;
|
||||||
*) # default emoji "🎲"
|
*) # default emoji "🎲"
|
||||||
emoji='\u201c\ud83c\udfb2\u201d' ;;
|
emoji='\ud83c\udfb2' ;;
|
||||||
esac
|
esac
|
||||||
sendJson "$1" '"emoji": "'"${emoji}"'"'"${reply}" "${URL}/sendChatAction" &
|
sendJson "$1" '"emoji": "'"${emoji}"'"'"${reply}" "${URL}/sendDice"
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1 CHAT $2 lat $3 long
|
# $1 CHAT $2 lat $3 long
|
||||||
|
|
Loading…
Reference in New Issue
Block a user