You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@commandkit/legacy

Package Overview
Dependencies
Maintainers
2
Versions
267
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commandkit/legacy

Legacy command handler plugin for CommandKit

0.1.1
latest
Source
npmnpm
Version published
Weekly downloads
1.3K
21.35%
Maintainers
2
Weekly downloads
 
Created
Source

@commandkit/legacy

Legacy command handler plugin for CommandKit.

Installation

npm install @commandkit/legacy

Usage

This package provides a commandkit plugin that enables legacy command handler.

import { legacy } from '@commandkit/legacy';

export default defineConfig({
  plugins: [legacy()],
});

This plugin also enables HMR for legacy commands, events and validations.

Using localization api with legacy commands

Since localization api is accessed through ctx.locale() in commandkit, legacy commands are not able to use this api as ctx is not exposed to legacy commands to maintain backward compatibility. In order to use the localization api with legacy commands, this plugin exposes locale() hook to access the localization api.

import { locale } from '@commandkit/legacy';

export const data = {
  name: 'hello',
  description: 'Say hello',
};

export async function run({ interaction }) {
  // initialize the localization api
  const { t } = locale();

  // use the localization api
  const message = await t('hello', {
    name: interaction.user.username,
  });

  // send the message
  await interaction.reply(message);
}

The locale() function can only be called inside the run function of the legacy command (or any other functions invoked inside the run function).

Keywords

commandkit

FAQs

Package last updated on 02 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.