discord
GitHub通过Discord API读取用户身份及所属服务器列表。支持验证认证、获取账号信息和服务器详情。仅限只读权限,无法发送消息或管理频道。需处理401/429错误,并明确区分OAuth与Bot权限差异。
Trigger Scenarios
Install
npx skills add NeverSight/learn-skills.dev --skill discord -g -y
SKILL.md
Frontmatter
{
"name": "discord",
"license": "Apache-2.0",
"metadata": {
"author": "acedatacloud",
"version": "1.0"
},
"connections": [
"discord"
],
"description": "Read your Discord identity and the list of servers (guilds) you belong to via the Discord API. Use when the user mentions Discord, asks which servers\/guilds they are in, or wants their Discord account info.",
"when_to_use": "Trigger when the user wants to read their Discord account identity\n(username, avatar, email) or list the servers (guilds) their connected\nDiscord account belongs to. This connection is read-only identity +\nguild list; it CANNOT read or send channel messages.\n",
"allowed_tools": [
"Bash"
]
}
We drive the Discord API
with curl + jq. The user's OAuth bearer token is in $DISCORD_TOKEN;
every call needs it as Authorization: Bearer $DISCORD_TOKEN. Use the
versioned base URL https://discord.com/api/v10.
Discord returns standard JSON. Errors look like
{"code": <n>, "message": "<reason>"}. A 401 Unauthorized means the
token expired or the connection was revoked — tell the user to re-connect
Discord at auth.acedata.cloud/user/connections. A 429 carries a
retry_after (seconds) field — sleep that long, then retry; never
parallelize.
Scope is read-only identify + email + guilds. This OAuth
connection can ONLY read the account's identity and the list of guilds it
belongs to. It CANNOT read/send channel messages, list a guild's channels
or members, or manage anything — those require a Discord Bot (bot
token + gateway), which this connector does not provide. Do not call
/guilds/{id}/channels, /channels/..., or /guilds/{id}/members — they
return 401/403 with a user OAuth token. If the user asks for those, say it
needs a Discord bot integration, which isn't set up.
Recipes
Verify auth + identity (always run first)
curl -sS -H "Authorization: Bearer $DISCORD_TOKEN" \
"https://discord.com/api/v10/users/@me" \
| jq '{id, username, global_name, email, avatar}'
List the servers (guilds) the user is in
curl -sS -H "Authorization: Bearer $DISCORD_TOKEN" \
"https://discord.com/api/v10/users/@me/guilds" \
| jq 'map({id, name, owner, approximate_member_count})'
Add ?with_counts=true to include approximate_member_count /
approximate_presence_count:
curl -sS -H "Authorization: Bearer $DISCORD_TOKEN" \
"https://discord.com/api/v10/users/@me/guilds?with_counts=true" \
| jq 'map({id, name, owner, members: .approximate_member_count})'
Notes
- A "server" in the UI is a "guild" in the API.
owner: truemeans the user owns that guild. - Guild icon URL (when
iconis non-null):https://cdn.discordapp.com/icons/<guild_id>/<icon>.png(use.gifif the icon hash starts witha_). - The guild list paginates at 200; the typical user is in far fewer, so a
single call is usually enough. If you ever hit 200, paginate with
?after=<last_guild_id>.
Version History
- e0220ca Current 2026-07-05 22:53


