Skip to main content

npm

Source

Description

@wolfstar/discord-utilities is a drop-in replacement for @sapphire/discord-utilities. It ships the same exports: limits namespaces, regexes, and option resolvers. They work only on the raw Discord API, with no dependency on discord.js, @discordjs/*, or @sapphire/*. The package has no runtime dependencies of its own. You can use it from a gateway bot, an HTTP interactions bot, a worker, or a test suite. discord-api-types is a peer dependency.
@wolfstar/http-framework-utilities re-exports everything from this package. If you already use it, you don’t need a separate import.

Usage

Limits and regexes

Use the limits namespaces to validate content against Discord’s limits, and the regexes to match snowflakes, mentions, emojis, and other Discord formats.

Option resolvers over a raw payload

The package exports four resolvers that read options from raw interaction payloads:
  • ChatInputInteractionOptionResolver
  • AutocompleteInteractionOptionResolver
  • ContextMenuInteractionOptionResolver
  • ModalInteractionOptionResolver

Migrating from @sapphire/discord-utilities

Change the import specifier. Every limits namespace, regex, and resolver keeps its original name.

License

Licensed under the Apache-2.0 license. Portions are ported from @sapphire/discord-utilities, © 2020 The Sapphire Community and its contributors, under the MIT License.