Plugin Editable Commands
Introduction
@sapphire/plugin-editable-commands is a tiny wrapper on top of @skyra/editable-commands that
re-exports everything and registers a listener to make commands also run on message edit.
Installation
- npm
- yarn
- pnpm
npm install @sapphire/plugin-editable-commands @sapphire/framework
yarn add @sapphire/plugin-editable-commands @sapphire/framework
pnpm add @sapphire/plugin-editable-commands @sapphire/framework
Usage
In your main or setup file, register the plugin:
- CommonJS
- ESM
- TypeScript
require('@sapphire/plugin-editable-commands/register');
import '@sapphire/plugin-editable-commands/register';
import '@sapphire/plugin-editable-commands/register';
Then use send or reply from the package, as shown below:
- CommonJS
- ESM
- TypeScript
const { Command } = require('@sapphire/framework');
const { EmbedBuilder } = require('discord.js');
const { send } = require('@sapphire/plugin-editable-commands');
class UserCommand extends Command {
  constructor(context, options) {
    super(context, {
      ...options,
      description: 'A very cool command',
      requiredClientPermissions: ['EMBED_LINKS']
    });
  }
  messageRun(message) {
    const embed = new EmbedBuilder()
      .setURL('https://github.com/skyra-project/editable-commands')
      .setColor('#7586D8')
      .setDescription('Example description')
      .setTimestamp();
    return send(message, { embeds: [embed] });
  }
}
module.exports = {
  UserCommand
};
import { Command } from '@sapphire/framework';
import { EmbedBuilder } from 'discord.js';
import { send } from '@sapphire/plugin-editable-commands';
export class UserCommand extends Command {
  constructor(context, options) {
    super(context, {
      ...options,
      description: 'A very cool command',
      requiredClientPermissions: ['EMBED_LINKS']
    });
  }
  messageRun(message) {
    const embed = new EmbedBuilder()
      .setURL('https://github.com/skyra-project/editable-commands')
      .setColor('#7586D8')
      .setDescription('Example description')
      .setTimestamp();
    return send(message, { embeds: [embed] });
  }
}
import { Command } from '@sapphire/framework';
import { Message, EmbedBuilder } from 'discord.js';
import { send } from '@sapphire/plugin-editable-commands';
export class UserCommand extends Command {
  public constructor(context: Command.LoaderContext, options: Command.Options) {
    super(context, {
      ...options,
      description: 'A very cool command',
      requiredClientPermissions: ['EMBED_LINKS']
    });
  }
  public messageRun(message: Message) {
    const embed = new EmbedBuilder()
      .setURL('https://github.com/skyra-project/editable-commands')
      .setColor('#7586D8')
      .setDescription('Example description')
      .setTimestamp();
    return send(message, { embeds: [embed] });
  }
}