npm.io
0.2.1 • Published yesterday

@saykit/carbon

Licence
MIT
Version
0.2.1
Deps
0
Size
9 kB
Vulns
0
Weekly
0
Stars
6

@saykit/carbon

Carbon Discord bot integration for SayKit.

Coverage

Registers a shared Say with your Carbon client, helps command and component classes expose translated metadata, and adds locale-aware interaction.say and guild.say properties.

Install

pnpm add @saykit/carbon saykit @buape/carbon

Usage

import { Client, Command, type CommandInteraction } from '@buape/carbon';
import { SayPlugin, withSay } from '@saykit/carbon';
import { type Say } from 'saykit';
import say from './i18n.js';

class PingCommand extends withSay(Command) {
  constructor(say: Say) {
    super(say, (say) => ({
      name: say`ping`,
      description: say`Ping the bot!`,
    }));
  }

  async run(interaction: CommandInteraction) {
    await interaction.reply({ content: interaction.say`Pong!` });
  }
}

const client = new Client(
  {
    /* options */
  },
  { commands: [new PingCommand(say)] },
  [new SayPlugin(say)],
);

Documentation

Carbon integration guide at saykit.js.org.

Keywords