koia

A slash command framework.

Usage no npm install needed!

<script type="module">
  import koia from 'https://cdn.skypack.dev/koia';
</script>

README

Koia

A scalable discord.js command framework that supports both text-based and slash commands.

Overview

Koia splits up groups of commands and listeners into plugins. They can be unloaded and loaded as required and has many features to make bot creation easy.

It has many features, including but not limited to:

  • Automatically registering and updating slash commands.
  • Support for both text-based and slash commands.
  • Clean and performant code.

Examples

Typescript:

import { Client, plugin, textCommand } from 'koia';

// Register a text-based command.
const command = textCommand({
  name: 'ping',
  run: ({ message }) => {
    return message.channel.send('Pong!');
  }
});

// Register a plugin.
const utility = plugin({
  name: 'utility',
  commands: [command],
  onLoad: () => console.log('Loaded utility plugin!')
});

const client = new Client({
  // intents, plugins, and prefix are the required options.
  intents: ['GUILDS', 'GUILD_MESSAGES'],
  plugins: [utility],
  prefix: '!'
});

// Connect and startup the bot.
client.login('BOT_TOKEN');

JavaScript:

const { Client, plugin, slashCommand } = require('koia');

// Register a slash command.
const command = slashCommand({
  name: 'ping',
  description: 'Pings the bot.',
  options: [],

  run: ({ interaction }) => {
    return interaction.reply('Pong!');
  }
});

const utility = plugin({
  name: 'utility',
  slash_commnads: [command],
  onLoad: () => console.log('Loaded utility plugin!')
});

const client = new Client({
  // intents, plugins, and prefix are the required options.
  intents: ['GUILDS', 'GUILD_MESSAGES'],
  plugins: [utility],
  prefix: '!'
});

client.login('BOT_TOKEN');