Skip to content

Ahemtan/bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 Discord Bot

A modular and scalable Discord bot built using discord.js.
It supports command and event handling, dotenv configuration, and code formatting via Biome.


📁 Project Structure


src
├── commands/      # Command definitions
│   └── ping.js
├── events/        # Discord event handlers
│   └── ready.js
├── functions/     # Utility functions (e.g., loader)
│   └── loadCommands.js
└── index.js       # Entry point


🚀 Getting Started

1. Prerequisites

2. Installation

git clone https://github.com/ahemtan/your-repo-name.git
cd your-repo-name
npm install

3. Configuration

Create a .env file in the root of your project:

DISCORD_TOKEN=your-bot-token-here

💻 Usage

Run in Development Mode (auto-restarts on changes)

npm run dev

Run in Production

npm start

🧹 Code Linting & Formatting

This project uses Biome for linting and formatting.

npm run lint
# or
npm run format

🧠 Example Files

🔹 src/commands/ping.js

module.exports = {
  name: "ping",
  description: "Replies with Pong!",
  async execute(interaction) {
    await interaction.reply("Pong!");
  },
};

🔹 src/events/ready.js

module.exports = {
  name: "ready",
  once: true,
  execute(client) {
    console.log(`✅ Logged in as ${client.user.tag}`);
  },
};

🔹 src/functions/loadCommands.js

const fs = require("node:fs");
const path = require("node:path");

module.exports = (client) => {
  const commandsPath = path.join(__dirname, "../commands");
  const commandFiles = fs
    .readdirSync(commandsPath)
    .filter((file) => file.endsWith(".js"));

  for (const file of commandFiles) {
    const filePath = path.join(commandsPath, file);
    const command = require(filePath);
    if (command.name) {
      client.commands.set(command.name, command);
    }
  }
};

🧩 Dependencies

  • discord.js — Main library for interacting with the Discord API.
  • dotenv — Load environment variables from .env.
  • axios — For making API requests (if needed).

Dev Dependencies


👤 Author

Made with ❤️ by ahemtan


📄 License

Licensed under the ISC License



---

Let me know if you'd like:

- Slash command support added
- Docker setup instructions
- A full working `index.js` example
- Make sure to add .env before running

Happy coding! 🚀

About

A discord bot!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors