Skip to content

code-brothers-inc/juninho-bot

Repository files navigation

Juninho 🤖

A Discord bot built with TypeScript and discord.js. We wanted to make a pet for our server, so that's why this exists!

Description

Juninho is our server's digital pet companion, designed to add some personality and fun interactions to our Discord community. Built with modern TypeScript and the latest discord.js library, this bot serves as both a practical utility and a friendly presence in our server.

Prerequisites

  • Node.js 22.12.0 or higher - This project requires Node.js version 22 or later
  • Yarn (or npm) - Package manager for installing dependencies
  • Discord Bot Token - You'll need to create a Discord application and bot

Getting Started

1. Clone the Repository

git clone <your-repository-url>
cd juninho

2. Install Dependencies

yarn install
# or
npm install

3. Configure Environment Variables

Create a .env file in the root directory with the following variables:

APPLICATION_ID=your_discord_application_id_here
DISCORD_TOKEN=your_discord_bot_token_here

How to get these values:

  • Go to the Discord Developer Portal
  • Create a new application (or select an existing one)
  • APPLICATION_ID: Found on the "General Information" page
  • DISCORD_TOKEN: Found on the "Bot" page (you may need to reset the token to see it)

4. Build the Project

Compile the TypeScript code to JavaScript:

yarn build
# or
npm run build

5. Deploy Commands

Register the bot's slash commands with Discord:

yarn deploy
# or
npm run deploy

6. Start the Bot

Run the bot:

yarn start
# or
npm start

Available Scripts

The following scripts are available in package.json:

  • yarn build - Compiles TypeScript files to JavaScript in the dist/ directory
  • yarn deploy - Deploys/registers slash commands to Discord
  • yarn start - Starts the bot (requires build first)
  • yarn lint - Checks code formatting and linting issues
  • yarn format - Automatically fixes formatting and linting issues

Project Structure

juninho/
├── src/
│   ├── commands/        # Slash commands
│   │   ├── ping.ts      # Example ping command
│   │   └── utility/     # Utility commands
│   ├── events/          # Discord event handlers
│   │   ├── ready.ts     # Bot ready event
│   │   └── interactionCreate.ts  # Command interactions
│   ├── util/            # Utility functions
│   │   ├── deploy.ts    # Command deployment script
│   │   └── loaders.ts   # Dynamic module loaders
│   └── index.ts         # Main entry point
├── dist/                # Compiled JavaScript (generated)
├── .env                 # Environment variables (not in git)
└── package.json         # Project dependencies and scripts

Adding New Commands

  1. Create a new file in src/commands/ (e.g., mycommand.ts)
  2. Export a command object following this structure:
import type { Command } from './index.js';

export default {
  data: {
    name: 'mycommand',
    description: 'Description of my command',
  },
  async execute(interaction) {
    await interaction.reply('Response here!');
  },
} satisfies Command;
  1. Rebuild the project: yarn build
  2. Deploy the new command: yarn deploy
  3. Restart the bot: yarn start

Development

For development with auto-formatting and linting:

# Check for issues
yarn lint

# Auto-fix issues
yarn format

Technologies Used

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published