npx skills add https://github.com/vm0-ai/vm0-skills --skill discord通过直接的 curl 调用使用 Discord Bot API 来管理频道、服务器、消息和用户。
官方文档:
https://discord.com/developers/docs
当你需要以下功能时,请使用此技能:
对于简单的消息发布,请使用 discord-webhook 技能。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
export DISCORD_BOT_TOKEN="MTIzNDU2Nzg5MDEyMzQ1Njc4OQ.ABcDeF.xxxxx..."
在 Bot 部分,启用:
bot,applications.commands启用开发者模式:用户设置 → 高级 → 开发者模式 右键点击任意频道/用户/服务器 → 复制 ID
基础 URL:https://discord.com/api/v10
授权请求头:Authorization: Bot YOUR_TOKEN
curl -s "https://discord.com/api/v10/users/@me" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" | jq '{id, username, discriminator}'
写入 /tmp/discord_request.json:
{
"content": "Hello from bot!"
}
然后运行(将 <your-channel-id> 替换为实际的频道 ID):
curl -s -X POST "https://discord.com/api/v10/channels/<your-channel-id>/messages" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" -H "Content-Type: application/json" -d @/tmp/discord_request.json
写入 /tmp/discord_request.json:
{
"embeds": [
{
"title": "Bot Message",
"description": "This is from the bot API",
"color": 5793266
}
]
}
然后运行(将 <your-channel-id> 替换为实际的频道 ID):
curl -s -X POST "https://discord.com/api/v10/channels/<your-channel-id>/messages" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" -H "Content-Type: application/json" -d @/tmp/discord_request.json
将 <your-channel-id> 替换为实际的频道 ID:
curl -s "https://discord.com/api/v10/channels/<your-channel-id>" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" | jq '{id, name, type, guild_id}'
将 <your-channel-id> 替换为实际的频道 ID:
curl -s "https://discord.com/api/v10/channels/<your-channel-id>/messages?limit=10" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" | jq '.[] | {id, author: .author.username, content}'
将 <your-channel-id> 和 <your-message-id> 替换为实际的 ID:
curl -s "https://discord.com/api/v10/channels/<your-channel-id>/messages/<your-message-id>" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" | jq '{id, content, author: .author.username}'
将 <your-channel-id> 和 <your-message-id> 替换为实际的 ID:
curl -s -X DELETE "https://discord.com/api/v10/channels/<your-channel-id>/messages/<your-message-id>" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)"
将 <your-channel-id> 和 <your-message-id> 替换为实际的 ID:
curl -s -X PUT "https://discord.com/api/v10/channels/<your-channel-id>/messages/<your-message-id>/reactions/%F0%9F%91%8D/@me" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" -H "Content-Length: 0"
注意:表情符号必须进行 URL 编码(👍 = %F0%9F%91%8D)
将 <your-guild-id> 替换为实际的服务器 ID:
curl -s "https://discord.com/api/v10/guilds/<your-guild-id>" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" | jq '{id, name, member_count, owner_id}'
将 <your-guild-id> 替换为实际的服务器 ID:
curl -s "https://discord.com/api/v10/guilds/<your-guild-id>/channels" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" | jq '.[] | {id, name, type}'
将 <your-guild-id> 替换为实际的服务器 ID:
curl -s "https://discord.com/api/v10/guilds/<your-guild-id>/members?limit=10" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" | jq '.[] | {user: .user.username, nick, joined_at}'
将 <your-guild-id> 替换为实际的服务器 ID:
curl -s "https://discord.com/api/v10/guilds/<your-guild-id>/roles" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" | jq '.[] | {id, name, color, position}'
写入 /tmp/discord_request.json:
{
"name": "My Webhook"
}
然后运行(将 <your-channel-id> 替换为实际的频道 ID):
curl -s -X POST "https://discord.com/api/v10/channels/<your-channel-id>/webhooks" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" -H "Content-Type: application/json" -d @/tmp/discord_request.json | jq '{id, token, url: "https://discord.com/api/webhooks/\(.id)/\(.token)"}'
将 <your-channel-id> 替换为实际的频道 ID:
curl -s "https://discord.com/api/v10/channels/<your-channel-id>/webhooks" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" | jq '.[] | {id, name, token}'
写入 /tmp/discord_request.json:
{
"name": "new-channel",
"type": 0
}
然后运行(将 <your-guild-id> 替换为实际的服务器 ID):
curl -s -X POST "https://discord.com/api/v10/guilds/<your-guild-id>/channels" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" -H "Content-Type: application/json" -d @/tmp/discord_request.json | jq '{id, name}'
| 类型 | 描述 |
|---|---|
| 0 | 文本频道 |
| 2 | 语音频道 |
| 4 | 分类 |
| 5 | 公告频道 |
| 13 | 舞台频道 |
| 15 | 论坛频道 |
X-RateLimit-* 请求头;实现退避机制/v10 获取最新的稳定 API每周安装数
94
仓库
GitHub 星标数
51
首次出现
2026年1月24日
安全审计
安装于
opencode80
gemini-cli79
codex77
github-copilot74
cursor74
amp73
Use the Discord Bot API via direct curl calls to manage channels, guilds, messages, and users.
Official docs:
https://discord.com/developers/docs
Use this skill when you need to:
For simple message posting, use discord-webhook skill instead.
export DISCORD_BOT_TOKEN="MTIzNDU2Nzg5MDEyMzQ1Njc4OQ.ABcDeF.xxxxx..."
In Bot section, enable:
bot, applications.commandsEnable Developer Mode: User Settings → Advanced → Developer Mode Right-click any channel/user/server → Copy ID
Base URL: https://discord.com/api/v10
Authorization header: Authorization: Bot YOUR_TOKEN
curl -s "https://discord.com/api/v10/users/@me" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" | jq '{id, username, discriminator}'
Write to /tmp/discord_request.json:
{
"content": "Hello from bot!"
}
Then run (replace <your-channel-id> with the actual channel ID):
curl -s -X POST "https://discord.com/api/v10/channels/<your-channel-id>/messages" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" -H "Content-Type: application/json" -d @/tmp/discord_request.json
Write to /tmp/discord_request.json:
{
"embeds": [
{
"title": "Bot Message",
"description": "This is from the bot API",
"color": 5793266
}
]
}
Then run (replace <your-channel-id> with the actual channel ID):
curl -s -X POST "https://discord.com/api/v10/channels/<your-channel-id>/messages" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" -H "Content-Type: application/json" -d @/tmp/discord_request.json
Replace <your-channel-id> with the actual channel ID:
curl -s "https://discord.com/api/v10/channels/<your-channel-id>" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" | jq '{id, name, type, guild_id}'
Replace <your-channel-id> with the actual channel ID:
curl -s "https://discord.com/api/v10/channels/<your-channel-id>/messages?limit=10" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" | jq '.[] | {id, author: .author.username, content}'
Replace <your-channel-id> and <your-message-id> with the actual IDs:
curl -s "https://discord.com/api/v10/channels/<your-channel-id>/messages/<your-message-id>" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" | jq '{id, content, author: .author.username}'
Replace <your-channel-id> and <your-message-id> with the actual IDs:
curl -s -X DELETE "https://discord.com/api/v10/channels/<your-channel-id>/messages/<your-message-id>" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)"
Replace <your-channel-id> and <your-message-id> with the actual IDs:
curl -s -X PUT "https://discord.com/api/v10/channels/<your-channel-id>/messages/<your-message-id>/reactions/%F0%9F%91%8D/@me" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" -H "Content-Length: 0"
Note: Emoji must be URL encoded (👍 = %F0%9F%91%8D)
Replace <your-guild-id> with the actual guild ID:
curl -s "https://discord.com/api/v10/guilds/<your-guild-id>" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" | jq '{id, name, member_count, owner_id}'
Replace <your-guild-id> with the actual guild ID:
curl -s "https://discord.com/api/v10/guilds/<your-guild-id>/channels" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" | jq '.[] | {id, name, type}'
Replace <your-guild-id> with the actual guild ID:
curl -s "https://discord.com/api/v10/guilds/<your-guild-id>/members?limit=10" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" | jq '.[] | {user: .user.username, nick, joined_at}'
Replace <your-guild-id> with the actual guild ID:
curl -s "https://discord.com/api/v10/guilds/<your-guild-id>/roles" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" | jq '.[] | {id, name, color, position}'
Write to /tmp/discord_request.json:
{
"name": "My Webhook"
}
Then run (replace <your-channel-id> with the actual channel ID):
curl -s -X POST "https://discord.com/api/v10/channels/<your-channel-id>/webhooks" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" -H "Content-Type: application/json" -d @/tmp/discord_request.json | jq '{id, token, url: "https://discord.com/api/webhooks/\(.id)/\(.token)"}'
Replace <your-channel-id> with the actual channel ID:
curl -s "https://discord.com/api/v10/channels/<your-channel-id>/webhooks" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" | jq '.[] | {id, name, token}'
Write to /tmp/discord_request.json:
{
"name": "new-channel",
"type": 0
}
Then run (replace <your-guild-id> with the actual guild ID):
curl -s -X POST "https://discord.com/api/v10/guilds/<your-guild-id>/channels" -H "Authorization: Bot $(printenv DISCORD_BOT_TOKEN)" -H "Content-Type: application/json" -d @/tmp/discord_request.json | jq '{id, name}'
| Type | Description |
|---|---|
| 0 | Text channel |
| 2 | Voice channel |
| 4 | Category |
| 5 | Announcement |
| 13 | Stage |
| 15 | Forum |
X-RateLimit-* headers; implement backoff/v10 for latest stable APIWeekly Installs
94
Repository
GitHub Stars
51
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
opencode80
gemini-cli79
codex77
github-copilot74
cursor74
amp73
通过 LiteLLM 代理让 Claude Code 对接 GitHub Copilot 运行 | 高级变通方案指南
43,100 周安装