BotWizardTS is a TypeScript-based Discord bot template that provides a dynamic slash command and event system. It serves as a starting point for creating powerful and extensible Discord bots with ease.
- Dynamic slash command system: Easily create, register, and manage slash commands with a simple and intuitive syntax.
- Event system: Handle various Discord events, such as message events, reaction events, member join events, and more, with flexibility and ease.
- TypeScript-based: Leverage the benefits of TypeScript, including static typing, improved code organization, and enhanced tooling support.
- Modular architecture: Organize your bot's functionality into modules for better code structure and maintainability.
- Built-in command and event handling: Handle commands and events effortlessly with built-in utilities and decorators.
- Customizable and extendable: Customize and extend the bot template to fit your specific needs.
To use BotWizardTS, make sure you have the following prerequisites installed:
- Node.js (version 12 or higher)
- npm (Node Package Manager)
- TypeScript
Follow the steps below to get started with BotWizardTS:
- Clone this repository to your local machine:
git clone https://github.com/Abdallah-Alwarawreh/BotWizardTS.git
- Install the project dependencies:
cd BotWizardTS
npm install
-
Configure your bot token:
- Rename the
.env.example
file to.env
. - Open the
.env
file and replaceYOUR_BOT_TOKEN
with your Discord bot token. You can obtain a token by creating a new bot on the Discord Developer Portal.
- Rename the
-
Build the TypeScript code:
npm run build
- Start the bot:
npm start
To create a new slash command, follow these steps:
- Create a new TypeScript file under the
src/Commands/<CommandCategory>/<CommandName>.ts
directory. - Define your command using the provided decorators and interfaces.
- Implement the command's functionality.
Here's an example of a simple ping command:
import { Command } from "../../Structures/Command";
export default new Command({
name: "ping",
description: "reply with pong",
run: async( {interaction} ) => {
interaction.followUp({
content: "Pong!",
});
}
});
Make sure to import the necessary decorators and interfaces from the discord.js
library.
BotWizardTS provides an event system that allows you to handle various Discord events. To create an event handler, follow these steps:
- Create a new TypeScript file under the
src/Events/<EventName>.ts
directory. - Define your event handler using the provided decorators and interfaces.
- Implement the event handling logic.
Here's an example of a simple message event handler:
import { CommandInteractionOptionResolver } from "discord.js";
import { Event } from "../Structures/Event";
import { client } from "../app";
import { ExtendedInteraction } from "../typings/Command";
export default new Event("messageCreate", async (message) => {
console.log(message.content);
});
Contributions are welcome! If you want to contribute to BotWizardTS, please follow the guidelines outlined in the CONTRIBUTING.md file.
This project is licensed under the License.
- Discord.js - A powerful library for interacting with the