Skip to main content

Built-in arguments

tip

These can be used anytime with the Args class, and can be accessed via container.stores.get('arguments').

Overriding

If you define an Argument with the same name as a built-in one, e.g. boolean ↗️, the one you define will replace the built-in one. This applies to all other stores from the framework and plugins.

To facilitate creating commands and getting your bot running, Sapphire bundles a large set of argument resolvers.

  • boolean: Resolves to a boolean ↗️ value.
  • channel: Resolves to a Channel ↗️ instance, given a channel name, mention or ID.
  • date: Resolves to a Date ↗️ instance, given a valid date format. For a list of valid date formats see Several ways to create a Date object on MDN ↗️
  • dmChannel: Resolves to a DMChannel ↗️ instance, given a DM channel ID or user's ID.
  • emoji: Resolves to an EmojiObject. The id is null for Twemojis.
  • float / number: Resolves to any number.
  • guild: Resolves to a Guild ↗️ instance, given ID.
  • guildCategoryChannel: Resolves to a CategoryChannel ↗️ instance, given a category channel name, mention or ID.
  • guildChannel: Resolves to a GuildChannel ↗️ or a ThreadChannel ↗️ instance, given a channel name, mention or ID.
  • guildNewsChannel: Resolves to a NewsChannel ↗️ instance, given a news channel name, mention or ID.
  • guildNewsThreadChannel: Resolves to a ThreadChannel ↗️ instance of type GUILD_NEWS_THREAD, given a thread channel name, mention or ID.
  • guildPrivateThreadChannel: Resolves to a ThreadChannel ↗️ instance of type GUILD_PRIVATE_THREAD, given a thread channel name, mention or ID.
  • guildPublicThreadChannel: Resolves to a ThreadChannel ↗️ instance of type GUILD_PUBLIC_THREAD, given a thread channel name, mention or ID.
  • guildStageVoiceChannel: Resolves to a StageChannel ↗️ instance, given a stage voice channel name, mention or ID.
  • guildTextChannel: Resolves to a TextChannel ↗️ instance, given a text channel name, mention or ID.
  • guildThreadChannel: Resolves to a ThreadChannel ↗️ instance, given a thread channel name, mention or ID.
  • guildVoiceChannel: Resolves to a VoiceChannel ↗️ instance, given a voice channel name, mention or ID.
  • hyperlink / url: Resolves to a URL ↗️ instance, given a valid URL.
  • integer: Resolves to a safe integer.
  • member: Resolves to a GuildMember ↗️ instance, given a member name, mention or ID.
  • message: Resolves to a Message ↗️ instance, given a message link or ID.
  • partialDMChannel: Resolves to a PartialDMChannel instance, given a DM channel ID or user's ID.
  • role: Resolves to a Role ↗️ instance, given a role name, mention or ID.
  • string: Resolves to a string containing the parameter.
  • user: Resolves to a User ↗️ instance, given a user mention or ID.
  • enum: Resolves to a string if it occurs within the array ↗️ of possible items that is passed as an option (enum).