A simple Discord bot that watches one channel, deletes messages sent there, and republishes their content as a formatted webhook embed. The original text is placed in the embed description, so Discord Markdown such as lists, bold text, inline code, code blocks, links, and visual mentions stays intact.
When mentioned_roles is configured, the role mention message is also sent by the same webhook to keep the same visual name and avatar.
- Node.js 20 or newer
- A bot created in the Discord Developer Portal
Message Content Intentenabled for the bot- Channel permissions:
- View Channels
- Send Messages
- Manage Messages
- Manage Webhooks
- Add Reactions
- Read Message History
- Create Public Threads
- Send Messages in Threads
-
Open the Discord Developer Portal: https://discord.com/developers/applications
-
Open your bot application.
-
Go to OAuth2 > URL Generator.
-
Under Scopes, select:
bot
-
Under Bot Permissions, select:
- View Channels
- Send Messages
- Manage Messages
- Manage Webhooks
- Add Reactions
- Read Message History
- Create Public Threads
- Send Messages in Threads
-
Copy the generated URL at the bottom of the page and open it in your browser.
You can also use this template URL, replacing YOUR_CLIENT_ID with your bot's Application ID / Client ID:
https://discord.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&permissions=309774593088&scope=bot
After inviting the bot, also check the channel configured in target_channel_id and make sure the bot role can view and send messages in that channel.
- Install dependencies:
npm install- Copy the example config:
copy config.example.yml config.ymlIn PowerShell, this also works:
Copy-Item config.example.yml config.yml- Edit
config.yml
token: bot token. You can also provide it through theDISCORD_TOKENenvironment variable.target_channel_id: channel the bot should watch.delete_original: whentrue, deletes the original message after the webhook sends the formatted version.mentioned_roles: roles that will be mentioned in the next message sent by the same webhook.mention_message: text used for the mention message. Use{roles}where the role mentions should appear.webhook.default_name: name used by the webhook.webhook.avatar_url: avatar used by the webhook. Leave it empty to use Discord's default.webhook.footer: embed footer.webhook.color: embed color in hexadecimal, such as#ff9900, orrandom.webhook.show_original_author: whentrue, shows the original message author in the embed.thread.enabled: whentrue, creates a discussion thread on the patch notes message.thread.name: optional custom thread name. You can use{webhook_name}and{message_id}placeholders.thread.auto_archive_duration: thread auto-archive duration in minutes. Discord accepts60,1440,4320, or10080.reactions.upandreactions.down: reactions added by the bot to the formatted message.
If webhook.id and webhook.token are empty, the bot automatically creates or reuses a webhook in the channel. This requires the Manage Webhooks permission.
npm startIf Missing Access appears, the bot started correctly, but Discord denied access to the channel configured in target_channel_id.
Check that:
- the bot is in the same server as the channel;
target_channel_idis actually the channel ID, not a category, server, or message ID;- the bot role can view the channel;
- the bot role is not blocked by channel-specific role overwrites;
- the channel allows
View Channels,Send Messages,Manage Messages,Manage Webhooks,Add Reactions,Read Message History,Create Public Threads, andSend Messages in Threads.
Original message:
- Fixed Mirage map without PvP.
- Fixed Besta Treta without arrows in the starter kit.
The bot deletes the original message, sends an embed through the webhook while preserving the list formatting, creates a discussion thread on that patch notes message, sends the configured role mentions through the same webhook, and reacts with up/down arrows.