Skip to content

Releases: Mimickal/discordjs-command-registry

Command handler decorators

23 Sep 21:49
efbc597
Compare
Choose a tag to compare

Note: v3.1.0 does not exist because I unpublished it after a bout of temporary insanity working directly off master

Added requireAdmin and requireGuild decorators that can wrap command handlers with common logic.

In the following example, using requireGuild allows the handler to skip checking if the interaction is happening in a guild.

const { requireGuild, SlashCommandBuilder } = require('discord-command-registry');

const cmd = new SlashCommandBuilder().setHandler(requireGuild(cmdHandler));

// interaction.guild is now guaranteed to not be null
function cmdHandler(interaction) {
    interaction.guild; // Not null!
}

Fix missing utility exports

16 Sep 07:26
a3dc628
Compare
Choose a tag to compare

...by removing them entirely.

  • Utility functions are no longer forwarded. Import these directly from discord.js instead. See #14.
  • The register script now has an option to print the library version.

Fix TypeScript errors

02 Sep 07:16
5b10d1d
Compare
Choose a tag to compare

This release fixes some scenarios where TypeScript would report type incompatibilities in builders.

  • .addXOption functions from Discord.js now preserve type information.
  • Handler functions now determine interaction type better.
  • Handler functions don't cause TypeScript errors anymore (no idea how I didn't catch this the first time around).

The port to TypeScript

22 May 04:51
20fc7f8
Compare
Choose a tag to compare

Changes:

  • This library now uses TypeScript! This should be a drop-in replacement, but with type safety now.
  • Our custom option resolvers now have first-class builder support. See addApplicationOption and addEmojiOption.
  • Tests are no longer packaged with the project. Unlikely this affects anybody, but it's worth mentioning.

Command registration script

22 Apr 15:11
625a1e0
Compare
Choose a tag to compare

This releases adds a script that will handle most basic registration cases. This avoids the need to write your own script to wrap SlashCommandBuilder.registerCommands(...). The script can be called from projects using this library as a dependency.

To run this script, use (note the -- to pass args through to the script):

npm exec register -- --help

(breaking) discord.js v14 support

21 Apr 10:56
c036365
Compare
Choose a tag to compare

This release updates the existing functionality to work with Discord.js version 14.
This is a breaking change. From this release on, all future updates will be for Discord.js v14.

If you still need v13 support, the 1.x versions of this library still work fine.

Fix raw Emoji ID resolution

30 Apr 18:19
54a613e
Compare
Choose a tag to compare

Attention: This is the most recent release that supports discord.js v13!

Options.getEmoji(...) was not properly resolving GuildEmoji from raw ID strings. It was, instead, returning the raw ID as a string, which newer versions of Discord.js doesn't play nice with. It now returns a GuildEmoji object when emojis are specified as raw Discord IDs.

Apologies to my TypeScript friends who are probably crying right now.

Fix multi-part emoji parsing

22 Apr 11:58
6628410
Compare
Choose a tag to compare

Options.getEmoji(...) was not properly recognizing multi-part emojis like 1️⃣ and 🕴️. Now it does.

Also update dependencies, so we're now using Discord API v10.

Add ContextMenuCommandBuilder support (and more!)

12 Dec 02:11
bcfa123
Compare
Choose a tag to compare

A couple of nice additions here;

  • ContextMenuCommandBuilder builders can now be defined with command handlers.
    const {  ApplicationCommandType, SlashCommandRegistry } = require('discord-command-registry');
    new SlashCommandBuilder().addContextMenuCommand(command => command
      .setName('menu-option')
      .setType(ApplicationCommandType.Message)
      .setHandler(interaction => interaction.reply('selected something from the menu!'))
    )
  • @discordjs/builders defined utility methods, such as bold for dressing up messages. These are all now forwarded through this library, so they can be directly imported.
    const { bold } = require('discord-command-registry');
  • Add new option helper for Emojis. Like Options.getApplication(...), you use this by defining string option, then using Option.getEmoji(interaction, 'opt_name') in your handler.
  • Option resolvers now support an optional third required argument to be in line with the ones built into Discord.js. Like the built-in ones, these default to false. Example: Option.getEmoji(interaction, 'opt_name', true).

Update dependencies

03 Dec 11:12
cd541fb
Compare
Choose a tag to compare

Update the discord-api-types and @discordjs/builders packages