discord

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Discord Direct API

Discord Direct API

Native OpenClaw Discord is session-bound. For cross-channel, use direct API.
原生OpenClaw Discord与会话绑定。如需跨渠道传递消息,请使用直接API。

Send Message

发送消息

bash
curl -X POST "https://discord.com/api/v10/channels/$CHANNEL_ID/messages" \
  -H "Authorization: Bot $DISCORD_BOT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"content": "<@USER_ID> message"}'
bash
curl -X POST "https://discord.com/api/v10/channels/$CHANNEL_ID/messages" \
  -H "Authorization: Bot $DISCORD_BOT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"content": "<@USER_ID> message"}'

Get Channel ID

获取频道ID

bash
curl "https://discord.com/api/v10/guilds/$GUILD_ID/channels" \
  -H "Authorization: Bot $DISCORD_BOT_TOKEN" | jq '.[] | {id, name}'
bash
curl "https://discord.com/api/v10/guilds/$GUILD_ID/channels" \
  -H "Authorization: Bot $DISCORD_BOT_TOKEN" | jq '.[] | {id, name}'

Get User ID

获取用户ID

bash
curl "https://discord.com/api/v10/guilds/$GUILD_ID/members?limit=100" \
  -H "Authorization: Bot $DISCORD_BOT_TOKEN" | jq '.[] | {id: .user.id, name: .user.username}'
bash
curl "https://discord.com/api/v10/guilds/$GUILD_ID/members?limit=100" \
  -H "Authorization: Bot $DISCORD_BOT_TOKEN" | jq '.[] | {id: .user.id, name: .user.username}'

Mentions

提及用户

<@USER_ID>
= notified.
@Name
= ignored.
<@USER_ID>
= 会@通知用户。
@Name
= 不会触发通知。