Last active
April 11, 2024 05:29
-
-
Save 182exe/81fbaac54d2aef8fece2580e4a4bc80c to your computer and use it in GitHub Desktop.
discord - simple webhook message edit (nodejs, axios)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios'); | |
const url = `https://discord.com/api/webhooks/<webhookid>/<webhooktoken>` | |
// initially post a message | |
// "?wait=true" url param tells discord to return a message object so we can get the id of it | |
axios.post(`${url}?wait=true`, { | |
content: "hi, test. this is the first message." | |
}).then((response) => { | |
// use PATCH method to edit webhooks | |
axios.patch(`${url}/messages/${response.data.id}`, {content: "edit?"}) | |
}); | |
// references: | |
// https://discord.com/developers/docs/resources/webhook#edit-webhook-message | |
// https://birdie0.github.io/discord-webhooks-guide/other/edit_webhook_message.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment