Wave is a feature-rich Discord bot built using the discord.js
library. This bot provides various functionalities including command handling, message logging, and dynamic command reloading. This README will guide you through setting up and using the bot, as well as provide information on the bot's features and commands.
- Command Handling: Responds to various commands with predefined actions.
- Message Logging: Logs recent messages from channels on bot startup.
- Dynamic Command Loading: Automatically loads and reloads commands from the
commands
directory. - Interaction Handling: Supports slash commands and interactions.
- Error Handling: Logs errors and warnings for debugging purposes.
- Bot Status Updates: Updates and logs the bot's status periodically.
- Node.js (version 16.6.0 or higher)
- A Discord bot token (from the Discord Developer Portal)
- Required npm packages
-
Clone the Repository
git clone https://github.com/waveoa/wave-open-repository.git cd wave-discord-bot
-
Install Dependencies
npm install
-
Create a Configuration File
Create a file named
config.json
in the root directory of your project with the following content:{ "token": "YOUR_BOT_TOKEN_HERE", "clientId": "YOUR_CLIENT_ID_HERE", "guildId": "YOUR_GUILD_ID_HERE" }
Replace
YOUR_BOT_TOKEN_HERE
with your actual bot token, andYOUR_CLIENT_ID_HERE
andYOUR_GUILD_ID_HERE
with your Discord application and server IDs, respectively.
Place your command files in the commands
directory. Each command file should export an object with the following structure:
module.exports = {
data: {
name: 'commandName', // Command name
description: 'Command description', // Command description (for slash commands)
},
execute(interaction) {
// Command logic here
},
};
Start the bot by running:
node index.js
The bot supports a variety of commands with the !
prefix. Here are some example commands:
-ping
: Responds with "Pong!"-info
: Provides information about the message sender and server.-help
: Displays a help message listing all available commands.
Commands are also handled via slash commands (e.g., /ping
). Ensure your bot has the appropriate permissions to register and use slash commands.
index.js
: Main bot script that initializes and starts the bot.commands/
: Directory containing command files.ping.js
: Example command file that handles the-ping
command.info.js
: Example command file that handles the-info
command.- Additional command files can be added here.
config.json
: Configuration file containing sensitive information (token, client ID, guild ID).
The bot logs errors and warnings to the console. Make sure to monitor these logs to ensure the bot is running smoothly.
- Dynamic Command Reloading: Commands are automatically reloaded when changes are detected in the
commands
directory. - Testing Commands: Test your commands by sending messages or using slash commands in your Discord server.
If you'd like to contribute to this project, please fork the repository and create a pull request with your changes.
This project is licensed under the Apache-2.0 License. See the LICENSE file for details.
- discord.js - The library used for interacting with the Discord API.
- Node.js - JavaScript runtime used for running the bot.