Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/megalithofficial/imari

Simple, fast and easy to use discord.js Typescript bot template.
https://github.com/megalithofficial/imari

beginner beginner-friendly bot bot-framework discord discord-api discord-bot discord-bot-template discord-bot-template-ts discord-js discord-js-v14 discord-ts easy-to-use example shard sharding typescript

Last synced: 10 days ago
JSON representation

Simple, fast and easy to use discord.js Typescript bot template.

Awesome Lists containing this project

README

        



Imari

Imari - Simple Discord Bot Template (TypeScript)


A starting point for building your own Discord bots using Discord.js and TypeScript.


Discord.js | Node.js

## Features

- 🚀 Ready-to-use structure for commands and events.
- 🎮 Integration with Discord.js V14 for smooth bot development.
- 🧭 Command handling and event registration.
- ⚙️ Customizable settings for your bot.
- 📖 Easy-to-follow documentation.
- 🌐 Seamlessly scalable with Discord.js Sharding included.

## Prerequisites

Before you start using this template, make sure you have the following:

- **Node.js:** You should have Node.js installed on your machine. Download it from [nodejs.org](https://nodejs.org/).
- **Knowledge:** You need to know TypeScript/JavaScript to effectively work with this template.

## Installation

To use this template to create your own Discord bot, follow these steps:

1. Clone or download this repository to your local machine.

2. Navigate to the project directory using your terminal.

3. Run the following command to install the necessary dependencies, including TypeScript (if not already installed):

```bash
npm install
```

Make sure to have TypeScript installed globally to use it during development. You can install it globally using:

```bash
npm install -g typescript
```

## Configuration

1. Duplicate the `.env.example` file in the root directory of your project and rename the duplicate to `.env`.

2. Configure your bot token and other settings in the `.env` file. Example:

```env
TOKEN=your_bot_token
SHARDING=false
TOTALSHARDS=AUTO
```

By following these steps, you'll have your project set up and ready to configure your Discord bot.

Testing

During development, you can test your code using TypeScript directly with the following command. Please note that you need to install `ts-node` globally only once:

```bash
npm install -g ts-node # Install ts-node globally (once)
npm run test
```

Building

To compile your TypeScript code into JavaScript for running your bot, execute the following command:

```bash
npm run build
```

Compiling the code enhances your bot application's performance by preparing it for execution.

Running the Bot

To run the bot using the built JavaScript code, use the following command:

```bash
npm run start
```

## Project Structure

The project structure is carefully organized to help you manage your Discord bot's components efficiently:

- 📁 `bot/commands/...`: This directory is where you store your bot's commands. You can create subdirectories to categorize and organize them.

- 📁 `bot/events/...`: In this directory, you define custom event handlers. This is where you listen for Discord events and execute custom code.

- 📜 `base/client.ts`: The heart of your bot application, where you manage the core functionalities.

- 📁 `utils/...`: The `utils` directory houses utility modules and helper functions. It's the place for shared scripts that assist with data manipulation, external API calls, and more. You can further categorize utilities based on their specific functions.

By maintaining this organized project structure, you ensure that your bot code remains clean and manageable. The `utils` directory, in particular, offers a central location for housing utility scripts, promoting code reusability and maintainability.

## Contributing

If you'd like to contribute to this project, please create a fork, make your changes, and submit a pull request.

## License

This project is licensed under the [Apache 2.0 License](LICENSE).

🤖 Happy bot building!