A simple yet powerful Discord bot built with Discord.js that can create threads and respond to slash commands.
- Create threads from messages
- Slash command support
- Easy to extend with new commands
- Error handling and logging
- Environment variable configuration
- Node.js v16.9.0 or higher
- npm or yarn package manager
- Discord Bot Token from Discord Developer Portal
-
Clone the repository:
git clone https://github.com/yourusername/discord-bot.git cd discord-bot -
Install dependencies:
npm install # or yarn install -
Create a
.envfile in the root directory with your bot token:DISCORD_TOKEN=your_bot_token_here
-
Start the bot:
node index.js
-
Invite the bot to your server using the following URL (replace
CLIENT_IDwith your bot's client ID):https://discord.com/oauth2/authorize?client_id=CLIENT_ID&permissions=8&scope=bot%20applications.commands
create [url]- Creates a new thread with the provided URL
/ping- Replies with 'Pong!'
discord-bot/
├── commands/ # Slash command files
├── node_modules/ # Dependencies
├── .env # Environment variables
├── .env.example # Example environment variables
├── .gitignore # Git ignore file
├── index.js # Main bot file
├── package.json # Project manifest
└── README.md # This file
Copy .env.example to .env and update the values:
DISCORD_TOKEN=your_bot_token_here- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.