A Discord bot built with TypeScript and discord.js. We wanted to make a pet for our server, so that's why this exists!
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.
- 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
git clone <your-repository-url>
cd juninhoyarn install
# or
npm installCreate a .env file in the root directory with the following variables:
APPLICATION_ID=your_discord_application_id_here
DISCORD_TOKEN=your_discord_bot_token_hereHow 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)
Compile the TypeScript code to JavaScript:
yarn build
# or
npm run buildRegister the bot's slash commands with Discord:
yarn deploy
# or
npm run deployRun the bot:
yarn start
# or
npm startThe following scripts are available in package.json:
yarn build- Compiles TypeScript files to JavaScript in thedist/directoryyarn deploy- Deploys/registers slash commands to Discordyarn start- Starts the bot (requires build first)yarn lint- Checks code formatting and linting issuesyarn format- Automatically fixes formatting and linting issues
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
- Create a new file in
src/commands/(e.g.,mycommand.ts) - 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;- Rebuild the project:
yarn build - Deploy the new command:
yarn deploy - Restart the bot:
yarn start
For development with auto-formatting and linting:
# Check for issues
yarn lint
# Auto-fix issues
yarn format- discord.js v14 - Discord API library
- TypeScript - Type-safe JavaScript
- @discordjs/core - Core Discord functionality
- Zod - TypeScript-first schema validation
- ESLint & Prettier - Code quality and formatting