This is a bot that automatically creates threads in a Discord channel, when a message is posted.
- Create a new Discord application from the Discord Developer Portal.
- Create a bot and generate a token.
- Create
src/config.json
with the following content:
{
"DiscordBotToken": "<YOUR TOKEN HERE>",
"GuildId": "",
"ChannelId": ""
}
- Install deps.
yarn install
- Run the bot.
yarn build && node .
- Invite the bot to a server. You can get the invite link from the console.
- Restart the bot.
^C
(Ctrl-C) andnode .
- Console shows the server name and ID, and its channel names and IDs. Copy the IDs where you want to create threads to
src/config.json
. Server ID should beGuildId
and channel ID should beChannelId
insrc/config.json
. - Restart the bot.
^C
(Ctrl-C) andyarn start
- Now try posting a message in the channel. The bot will create a thread.
- To stop the bot,
yarn stop