Project structure
The bot follows a modular architecture with clear separation of concerns:Core initialization
The bot initializes insrc/index.js:1 with the following flow:
The gcommands framework
Yato uses gcommands v5.2.4 to handle both slash commands and message-based commands with a single codebase.Key features
Dual command support
Commands work as both slash commands and mention-based prefix commands (
@Yato help).Automatic registration
Commands in
src/commands/ are automatically loaded and registered.Built-in validation
Permission checks, argument validation, and cooldowns are handled by the framework.
Interaction components
Provides utilities for buttons, select menus, and other Discord components.
Configuration options
The gcommands client accepts several configuration options:| Option | Value | Purpose |
|---|---|---|
cmdDir | 'src/commands/' | Directory containing command modules |
language | 'english' | Default language for built-in messages |
ownLanguageFile | Custom JSON | Override default error messages |
slash | 'both' | Enable both slash and prefix commands |
prefix | Mention regex | Commands triggered by mentioning the bot |
defaultCooldown | '3s' | Default cooldown between command uses |
Custom structures
Yato extends Discord.js functionality with custom structures:BotEmbed
Located atsrc/structures/BotEmbed.js:1, this class extends MessageEmbed with a splitFields() method that automatically handles long content by splitting it across multiple embed fields.
CanvasUtils
Provides image manipulation helpers atsrc/structures/CanvasUtils.js:1:
- Custom context methods:
roundImage(),circle(),roundRect(),write() - Font registration: Montserrat and Segoe UI families
- Text alignment: 9-point alignment system (top-left, center, etc.)
- Advanced effects: Blur, icon coloring, paragraph wrapping
Canvas utilities must be initialized before the bot starts by calling
CanvasUtils.initializeHelpers() in the entry file.Utils module
Thesrc/structures/utils.js:1 file contains shared utilities:
cleanHTML()- Strip HTML tags from textdescriptionParser()- Truncate descriptions to 800 charactersformatPerms()- Format permission names for displayformatArray()- Format arrays using Intl.ListFormatanimeMangaSearch()- Search anime/manga via AniList APIredditFetcher()- Fetch posts from Reddit
Command categories
Commands are organized into logical categories:Games
Games
Game server queries and integrations (Counter-Strike, Minecraft)
Images
Images
Anime reaction images (hug, pat, kiss, slap, etc.)
Information
Information
Server info, user info, bot stats, help menu
Memes
Memes
Meme and anime meme fetching from Reddit
Misc
Misc
Discord activities, avatars, documentation search
Moderation
Moderation
Kick, ban, and other moderation actions
Utilities
Utilities
Ping, uptime, purge messages, announcements
Weeb
Weeb
AniList and MyAnimeList integrations