File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222 local path="$2"
2323 local method="${3:-GET}"
2424 local body="${4:-}"
25- local out bodyf code
25+ local bodyf code
2626 bodyf=$(mktemp)
2727 if [ -n "$body" ]; then
2828 code=$(curl -sS --http1.1 -o "$bodyf" -w '%{http_code}' \
4646 }
4747
4848 pick() {
49- local body code auth label
50- while IFS='|' read -r label auth; do
49+ local body code auth label entry
50+ local pairs=(
51+ "user|$DISCORD_TOKEN"
52+ "bot|Bot $DISCORD_TOKEN"
53+ "bearer|Bearer $DISCORD_TOKEN"
54+ )
55+ for entry in "${pairs[@]}"; do
56+ IFS='|' read -r label auth <<< "$entry"
5157 mapfile -t out < <(call "$auth" /users/@me)
5258 code="${out[0]}"
5359 body="$(printf '%s\n' "${out[@]:1}")"
5763 printf '%s' "$auth"
5864 return 0
5965 fi
60- done <<EOF
61- user|$DISCORD_TOKEN
62- bot|Bot $DISCORD_TOKEN
63- bearer|Bearer $DISCORD_TOKEN
64- EOF
66+ done
6567 return 1
6668 }
6769
You can’t perform that action at this time.
0 commit comments