Opt*_*ist 7 json webhooks discord
如何使用 Discord webhooks 发布到频道线程,而不是频道本身?例如,我有一个名为视频的文本频道,其中有多个线程:A、B、C 等。我想使用 Webhook 自动将 URL 发布到特定线程中的新 YouTube 视频,但不直接发布到频道中。
是否可以使用线程 ID 以某种方式修改 Discord Webhook URL?
https://discord.com/developers/docs/resources/webhook
是否可以添加到 JSON 文件中?
请帮忙!
小智 8
您可以传递 thread_id 查询参数来向所需的线程添加评论。例如:
fetch(`https://discord.com/api/webhooks/${webhook.id}/${webhook.token}?thread_id=${thread.id}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ content: 'This is a comment under a thread!', })
});
Run Code Online (Sandbox Code Playgroud)
只需确保 Webhook ID 和令牌适用于线程所在的通道。