1
0
Fork
You've already forked OTDify
0
No description
JavaScript 100%
2025年12月02日 13:08:11 -06:00
commands Refactor OTD sources, add phobia and act of kindness OTDs, and remove unused commands and events. 2025年12月02日 13:08:11 -06:00
config Refactor OTD sources, add phobia and act of kindness OTDs, and remove unused commands and events. 2025年12月02日 13:08:11 -06:00
events Refactor OTD sources, add phobia and act of kindness OTDs, and remove unused commands and events. 2025年12月02日 13:08:11 -06:00
utils Refactor OTD sources, add phobia and act of kindness OTDs, and remove unused commands and events. 2025年12月02日 13:08:11 -06:00
.gitignore Start.bat used for server 2025年11月30日 16:52:30 -06:00
index.js Use applicationCommands route instead of applicationGuildCommands. 2025年12月01日 14:46:20 -06:00
LICENSE Initial commit 2025年11月30日 18:58:51 +01:00
package-lock.json Init 2025年11月30日 16:47:35 -06:00
package.json Init 2025年11月30日 16:47:35 -06:00
README.md Initial commit 2025年11月30日 18:58:51 +01:00

Discord.js Bot Template

A simple and modular Discord bot template built with Discord.js v14. This template provides a foundation for creating a Discord bot with slash commands and event handling, making it easy to extend with additional features.

Features

  • Slash Command Support: Includes a /ping command as an example, with a modular command structure.
  • Event Handling: Pre-configured event listeners for ready, interactionCreate, messageCreate, and guildMemberAdd.
  • Configuration Management: Centralized settings in config/settings.js for bot customization.
  • Environment Variables: Uses dotenv for secure management of sensitive data like the Discord bot token.
  • MIT License: Freely use, modify, and distribute the code under the MIT license.

Prerequisites

  • Node.js: Version 18 or higher.
  • Discord Bot Token: Obtainable from the Discord Developer Portal.
  • Basic Knowledge: Familiarity with JavaScript, Node.js, and Discord.js.

Setup

  1. Clone the Repository:

    git clone <repository-url>
    cd wranglerbot
    
  2. Install Dependencies:

    npm install
    
  3. Configure Environment Variables:

    • Create a .env file in the root directory.
    • Add your Discord bot token:
      DISCORD_TOKEN=your-bot-token-here
      
  4. Update Configuration:

    • Open config/settings.js and update the following:
      • bot.clientID: Your bot's client ID from the Discord Developer Portal.
      • bot.guildID: The ID of the guild (server) where you want to deploy slash commands.
      • bot.color: Customize the bot's embed color (hex code).
  5. Run the Bot:

    npm start
    

Project Structure

wranglerbot/
├── commands/
│ └── util/
│ └── ping.js # Example slash command
├── config/
│ └── settings.js # Bot configuration
├── events/
│ ├── guildMemberAdd.js # Handles new member events
│ ├── interactionCreate.js # Handles slash command interactions
│ ├── messageCreate.js # Handles message events
│ └── ready.js # Handles bot ready event
├── .env # Environment variables (not tracked)
├── index.js # Main bot entry point
├── LICENSE # MIT License
├── package.json # Project dependencies and scripts
├── package-lock.json # Dependency lock file
└── README.md # This file

Usage

  • Slash Commands: The template includes a /ping command that responds with "Pong!" and the bot's configured color. Add more commands by creating new files in the commands/ directory, following the structure of ping.js.
  • Events: Extend event functionality by modifying the files in the events/ directory. For example, add welcome messages in guildMemberAdd.js.
  • Deploying Commands: Slash commands are automatically deployed to the specified guild when the bot starts.

Adding New Commands

  1. Create a new file in the commands/ directory (e.g., commands/util/newcommand.js).
  2. Follow the structure of ping.js:
    const { SlashCommandBuilder } = require('discord.js');
    module.exports = {
     data: new SlashCommandBuilder()
     .setName('newcommand')
     .setDescription('Description of your command'),
     async execute(interaction, settings) {
     await interaction.reply('Your command response!');
     },
    };
    
  3. The command will be automatically loaded and deployed when you restart the bot.

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests to improve the template.

License

This project is licensed under the MIT License. See the LICENSE file for details.