Denizen Script Commands


Commands are always written with a '-' before them, and are the core component of any script, the primary way to cause things to happen.
Learn about how commands work in The Beginner's Guide.


Showing 1 out of 184 commands...
Namediscordcommand
Related Guide Pagehttps://guide.denizenscript.com/guides/expanding/ddiscordbot.html
Syntaxdiscordcommand (id:<bot>) [create/delete] (group:<group>) (name:<name>) (type:{slash}/user/message) (description:<description>) (options:<options>)
Short DescriptionManages Discord application commands.
Full DescriptionManages Discord application commands.

You can create a new command, edit the permissions of an existing command, or delete an existing command.

To create (or delete) a command in a specific Discord guild, use the "group" argument. If not present, a global command will be created. NOTE: Global commands take up to an hour to register.
When creating, both a name and description are required.

Commands can be slash commands - activated via typing "/", message commands - activated by right-clicking a message, or user commands - activated by right-clicking a user.
"Description" and "options" are only valid for slash commands.

The "options" argument controls the command parameters. It is a MapTag of ordered MapTags that can sometimes hold ordered MapTags. It is recommended to use Command:definemap or a data script key when creating commands.
All option MapTags must have "type", "name", and "description" keys, with an optional "required" key (defaulting to true). The "type" key can be one of: STRING, INTEGER, BOOLEAN, USER, CHANNEL, ROLE, MENTIONABLE, NUMBER, ATTACHMENT.
Additionally, the option map can include a "choices" key, which is a MapTag of ordered MapTags that have a "name" (what displays to the user) and a "value" (what gets passed to the client).
Instead of choices, the option map can also include an "autocomplete" key controlling whether dynamic suggestions can be provided to the client (defaulting to false). See Event:on discord command autocomplete.

Editing application command permissions has been moved to the "Integrations" section in the server settings.
Read more about it here: 🔗https://discord.com/blog/slash-commands-permissions-discord-apps-bots

You DO NOT need to create a command on startup every time! Once a command is created, it will persist until you delete it.
Using the "create" instruction on an existing command will update it.

Commands and replies to interactions have limitations. See 🔗https://gist.github.com/MinnDevelopment/b883b078fdb69d0e568249cc8bf37fe9.

See also Discord's internal API documentation for commands: 🔗https://discord.com/developers/docs/interactions/application-commands

Generally used alongside Command:discordinteraction

The command should usually be ~waited for. See Language:~waitable.
Related Tags<entry[saveName].command> returns the DiscordCommandTag of a command upon creation, when the command is ~waited for.
Usage Example
# Use to create a simple slash command without options and save it.
- ~discordcommand create group:<discord[mybot].group[Denizen]> name:hello "description:Hello world!" save:mycmd
- debug log <entry[mycmd].command.name>
Usage Example
# Use to create a global slash command with one option, using definemap.
- definemap options:
    1:
      type: string
      name: animal
      description: Your favorite animal
      required: true
- ~discordcommand id:mybot create name:animal "description:Pick your favorite!" options:<[options]>
Groupexternal
RequiresdDiscordBot
Sourcehttps://github.com/DenizenScript/dDiscordBot/blob/master/src/main/java/com/denizenscript/ddiscordbot/commands/DiscordCommandCommand.java#L40