- Node.js
- Discord.js
The DiscordFactory
will autoload all of your Discord commands and events.
If you want to add more events or commands, you just need to put them all in the events
and commands
folders.
You will need to assign your handler/command/event path. The handler will run commandHandler.ts
and eventHandler.ts
to autoload all of your commands and events into the Discord client.
You can keep this as the default. However, if you need to refactor the code, you will need to update the location. For example:
import { DiscordFactory } from "@service/discord/discordFactory";
const HANDLER_PATH = 'services/discord/handlers';
const COMMAND_PATH = "services/discord/commands";
const EVENT_PATH = "services/discord/events";
const discordFactory = new DiscordFactory(HANDLER_PATH, COMMAND_PATH, EVENT_PATH);
discordFactory.init();
npm update
yarn install
- Clone the repository:
git clone https://github.com/your-username/discord-bot-template.git
- Install dependencies:
cd discord-bot-template yarn install
- Set up the environment:
- Create a file
.env
at the root of the project. - Fill in the required values in the
.env
file, such as your bot token - There is an example env file
.example.env
DISCORD_TOKEN={Your Bot Token} AI_ACCESS_TOKEN={Your AI Access Token}
- Create a file
- Start the bot:
yarn start
For more detailed information on how to use and customize this Discord bot template, please refer to the documentation.
- Discord.js Intents: https://discordjs.guide/popular-topics/intents.html#privileged-intents
Let me know if there's anything else I can help you with!