Addon Development
Learn how to build your own features and extensions for Kythia.
Addons are the lifeblood of Kythia. Every feature—from simple pings to complex AI interactions—is implemented as an addon. This structure makes Kythia incredibly easy to maintain and extend.
Addon Structure
Every addon lives in its own folder within the addons/ directory.
-
addons/
-
birthday/
-
commands/ # Slash command files
-
components/ # Button/Modal handlers
-
events/ # Discord event listeners
-
helpers/ # Utility functions
-
lang/ # i18n translation files
-
addon.json # Metadata for the addon manager
-
-
The addon.json File
This file tells Kythia's AddonManager how to load your feature.
{
"name": "MyAwesomeAddon",
"version": "1.0.0",
"description": "Adds a cool new feature to your server.",
"active": true
}
Creating Your First Command
Let's build a simple /echo command that repeats whatever the user says.
addons/hello-world/commands/echo.js// addons/hello-world/commands/echo.js
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
slashCommand: new SlashCommandBuilder()
.setName('echo')
.setDescription('Repeats your message')
.addStringOption(option =>
option.setName('message').setDescription('The message to repeat').setRequired(true)
),
async execute(interaction, container) {
const { logger } = container;
const message = interaction.options.getString('message');
logger.info(`User ${interaction.user.tag} used echo: ${message}`);
await interaction.reply({ content: `You said: ${message}` });
}
};
Handling Events
Addons can also listen to any Discord event. Create an events/ folder and add a file named after the event you want to hear.
// addons/hello-world/events/MessageCreate.js
module.exports = {
name: 'messageCreate',
async execute(message, container) {
if (message.author.bot) return;
if (message.content.includes('hello kythia')) {
await message.reply('Hello! I am here to help. 🌸');
}
}
};
Adding Translations
Kythia is built for a global audience. Never hardcode strings! Use the lang/ folder.
-
Create
addons/hello-world/lang/en.json:{ "hello": { "greeting": "Hello {user}! Welcome to the server." } } -
Use it in your command:
const { t } = container; await interaction.reply(await t(interaction, 'hello.greeting', { user: interaction.user.username }));
Registering Your Addon
Once your files are in place:
- Ensure
active: trueis set in youraddon.json. - Add your addon to the
addonsblock inkythia.config.js(optional, but good for control). - Restart the bot.
- Run
npx kythia deployto register your new slash commands with Discord.
AddonManager uses "Hot Discovery". You don't need to register files manually; as long as they are in the correct directory, they will be loaded automatically!