# shellcheck shell=sh disable=SC2039,SC3043

___x_cmd_dingtalk_bot___send_json() {
    local req_json ; req_json="$(___x_cmd_cmds_cat)"
    dingtalk:debug "$(printf "%s" "$req_json" | ___x_cmd jo fmt)"

    [ -n "$webhook" ] || {
        local webhook
        ___x_cmd_dingtalk_cur webhook:= 2>/dev/null
        [ -n "$webhook" ] || N=dingtalk M="Please setting up your webhook first ==> 'x dingtalk --cfg webhook=<your webhook url>'" log:ret:1
    }

    dingtalk:debug "$webhook"
    ___x_cmd curl -s -X POST                                \
                  -H 'Content-Type: application/json'       \
                  -d "$req_json"                            \
                  "$webhook"
}
# "13427498660,13427498660,13427498660,"
___x_cmd_dingtalk___get_mobiles() {
    # TODO: tolerance.
    printf "%s" "$@" | ___x_cmd_cmds_awk '{ gsub(/,/, "\",\"", $0); print "\"" $0 "\"" }'
}
