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 11 out of 184 commands...
Namediscord
Related Guide Pagehttps://guide.denizenscript.com/guides/expanding/ddiscordbot.html
Syntaxdiscord [id:<id>] [disconnect/add_role/start_typing/remove_role/status (status:<status>) (activity:<activity>)/rename] (<value>) (message_id:<id>) (channel:<channel>) (user:<user>) (group:<group>) (role:<role>) (url:<url>)
Short DescriptionInteracts with Discord.
Full DescriptionInteracts with Discord.

Commands may fail if the bot does not have permission within the Discord group to perform them.

When setting the status of the Discord bot, the status argument can be: ONLINE, DND, IDLE, or INVISIBLE,
and the activity argument can be: PLAYING, STREAMING, LISTENING, or WATCHING.
Streaming activity requires a 'url:' input.

The command should always be ~waited for. See Language:~waitable.
Related Tags<discord[<bot_id>]> Returns the Discord bot for the given bot ID.
Usage Example
# Use to disconnect from Discord.
- ~discord id:mybot disconnect
Usage Example
# Use to add a role on a user in a Discord guild.
- ~discord id:mybot add_role user:<[user]> role:<[role]> group:<[group]>
Usage Example
# Use to remove a role on a user in a Discord guild.
- ~discord id:mybot remove_role user:<[user]> role:<[role]> group:<[group]>
Usage Example
# Use to set the online status of the bot, and clear the game status.
- ~discord id:mybot status "Minecraft" "status:ONLINE"
Usage Example
# Use to set the game status of the bot.
- ~discord id:mybot status "Minecraft" "status:ONLINE" "activity:PLAYING"
Usage Example
# Use to change the bot's nickname.
- ~discord id:mybot rename "<[nickname]>" group:<[group]>
Usage Example
# Use to give a user a new nickname.
- ~discord id:mybot rename "<[nickname]>" user:<[user]> group:<[group]>
Usage Example
# Use to start typing in a specific channel.
- ~discord id:mybot start_typing channel:<[channel]>
Groupexternal
RequiresdDiscordBot
Sourcehttps://github.com/DenizenScript/dDiscordBot/blob/master/src/main/java/com/denizenscript/ddiscordbot/commands/DiscordCommand.java#L38

Namediscordban
Related Guide Pagehttps://guide.denizenscript.com/guides/expanding/ddiscordbot.html
Syntaxdiscordban (id:<bot>) ({add}/remove) [user:<user>] [group:<group>] (reason:<reason>) (deletion_timeframe:<time>/{0s})
Short DescriptionBans or unbans a member from a group.
Full DescriptionBans or unbans a member from a group.

To ban a user, use the "add" argument. To unban a user, use the "remove" argument.
The group is required for both "add" and "remove" arguments, but "reason" can only be used with "add".
Reasons show up in the group's Audit Logs.

The "deletion_timeframe" argument will, if set, delete all messages sent by the user being banned within the timeframe given.
The timeframe defaults to 0 seconds, which will not delete any messages. The timeframe cannot be greater than 7 days.
This argument can only be used when adding a ban using the "add" argument, although it is not required.

The command should usually be ~waited for. See Language:~waitable.
Related Tags<DiscordUserTag.is_banned[<group>]> returns if the user is banned from a certain group.
<DiscordGroupTag.banned_members> returns a list of all banned members in a group.
Usage Example
# Bans a user with a reason and deletes all messages sent by the user in the past 2 hours.
- ~discordban id:mybot add user:<[user]> group:<[group]> "reason:Was being mean!" deletion_timeframe:2h
Usage Example
# Bans a user with but does not delete any messages sent and does not have a reason.
- ~discordban id:mybot add user:<[user]> group:<[group]>
Usage Example
# Unbans a user.
- ~discordban id:mybot remove user:<[user]> group:<[group]>
Groupexternal
RequiresdDiscordBot
Sourcehttps://github.com/DenizenScript/dDiscordBot/blob/master/src/main/java/com/denizenscript/ddiscordbot/commands/DiscordBanCommand.java#L27

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

Namediscordconnect
Related Guide Pagehttps://guide.denizenscript.com/guides/expanding/ddiscordbot.html
Syntaxdiscordconnect [id:<id>] [token:<secret>] (intents:<intent>|...)
Short DescriptionConnects to Discord.
Full DescriptionConnects to Discord.

The connection will automatically specify the following gateway intents:
GUILD_MEMBERS, GUILD_EMOJIS_AND_STICKERS, GUILD_MESSAGES, GUILD_MESSAGE_REACTIONS, DIRECT_MESSAGES, DIRECT_MESSAGE_REACTIONS, MESSAGE_CONTENT
Optionally specify additional Gateway Intents to use as a list of any of:
GUILD_BANS, GUILD_WEBHOOKS, GUILD_INVITES, GUILD_VOICE_STATES, GUILD_PRESENCES, GUILD_MESSAGE_TYPING, DIRECT_MESSAGE_TYPING

use "intents:clear|SOME_INTENT|etc" (ie the first entry as "clear") to clear out default intents and use only your manually specified choices.

Note that you need to enable the 'members' and 'message content' intent on your bot in Discord bot settings https://discord.com/developers/applications
And also may need to manually enable other intents if you specify any.
If the members intent is not enabled, a significant amount of dDiscordBot's functionality will not work.

Store your Discord bot token in the Denizen secrets file at 'plugins/Denizen/secrets.secret'. Refer to ObjectType:SecretTag for usage info.

The command should usually be ~waited for. See Language:~waitable.
Related Tags<discord[<bot_id>]> Returns the Discord bot for the given bot ID.
Usage Example
# Use to connect to Discord with a token stored in secret file 'plugins/Denizen/secrets.secret' and send a message once connected.
- ~discordconnect id:mybot token:<secret[discord_bot_token]>
- discordmessage id:mybot channel:<[my_log_channel]> "Connected!"
Groupexternal
RequiresdDiscordBot
Sourcehttps://github.com/DenizenScript/dDiscordBot/blob/master/src/main/java/com/denizenscript/ddiscordbot/commands/DiscordConnectCommand.java#L52

Namediscordcreatechannel
Syntaxdiscordcreatechannel (id:<bot>) [group:<group>] [name:<name>] (description:<description>) (type:<type>) (category:<category_id>) (position:<#>) (roles:<list>) (users:<list>)
Short DescriptionCreates text channels on Discord.
Full DescriptionCreates text channels on Discord.

This functionality requires the Manage Channels permission.

You can optionally specify the channel description (aka "topic") with the "description" argument.

You can optionally specify the channel type. Valid types are TEXT, NEWS, CATEGORY, and VOICE.
Only text and news channels can have a description.
Categories cannot have a parent category.

You can optionally specify the channel's parent category with the "category" argument.
By default, the channel will not be attached to any category.

You can optionally specify the channel's position in the list as an integer with the "position" argument.

You can optionally specify the roles or users that are able to view the channel.
The "roles" argument takes a list of DiscordRoleTags, and the "users" argument takes a list of DiscordUserTags.
Specifying either of these arguments will create a private channel (hidden for anyone not in the lists).

The command can be ~waited for. See Language:~waitable.
Related Tags<entry[saveName].channel> returns the DiscordChannelTag of a channel upon creation when the command is ~waited for.
Usage Example
# Use to create a channel in a category.
- discordcreatechannel id:mybot group:1234 name:my-channel category:5678
Usage Example
# Use to create a voice channel and log its name upon creation.
- ~discordcreatechannel id:mybot group:1234 name:very-important-channel type:voice save:stuff
- debug log "Created channel '<entry[stuff].channel.name>'"
Groupexternal
RequiresdDiscordBot
Sourcehttps://github.com/DenizenScript/dDiscordBot/blob/master/src/main/java/com/denizenscript/ddiscordbot/commands/DiscordCreateChannelCommand.java#L30

Namediscordcreatethread
Related Guide Pagehttps://guide.denizenscript.com/guides/expanding/ddiscordbot.html
Syntaxdiscordcreatethread (id:<bot>) [name:<name>] [message:<message>/parent:<channel> (private)]
Short DescriptionCreates a new Discord thread.
Full DescriptionCreates a new Discord thread.

You must specify the bot object ID, and the thread name.

You can either specify a full DiscordMessageTag instance to create a thread based on that message,
OR specify a DiscordChannelTag parent and optionally mark it private (otherwise it's public).

The command can be ~waited for. See Language:~waitable.
Related Tags<entry[saveName].created_thread> returns the newly created thread.
Usage Example
# Use to create a new thread for a specific message and send a bot message to it.
- ~discordcreatethread id:mybot "name:The bot's awesome thread" message:<context.message> save:thread
- discordmessage id:mybot channel:<entry[thread].created_thread> "Here I made this thread just for you"
Usage Example
# Use to create a new thread in a channel and link to it in some channel.
- ~discordcreatethread id:mybot "name:The bot's awesome thread" parent:<[some_channel]> save:thread
- discordmessage id:mybot channel:<[some_channel]> "I created thread <&lt>#<entry[thread].created_thread.id><&gt>!"
Groupexternal
RequiresdDiscordBot
Sourcehttps://github.com/DenizenScript/dDiscordBot/blob/master/src/main/java/com/denizenscript/ddiscordbot/commands/DiscordCreateThreadCommand.java#L30

Namediscordinteraction
Related Guide Pagehttps://guide.denizenscript.com/guides/expanding/ddiscordbot.html
Syntaxdiscordinteraction [defer/reply/delete] [interaction:<interaction>] (ephemeral) (rows:<rows>) (<message>) (embed:<embed>|...) (attach_files:<map>)
Short DescriptionManages Discord interactions.
Full DescriptionManages Discord interactions.

You can defer, reply to, edit, or delete an interaction. These instructions all require the "interaction" argument.

The "ephemeral" argument can be used to have the reply message be visible to that one user.

You can defer an interaction before replying, which is useful if your reply may take more than a few seconds to be selected.
If you defer, the 'ephemeral' option can only be set by the defer - you cannot change it with the later reply.
Replying to an interaction uses similar logic to normal messaging. See Command:discordmessage.
If you deferred without using 'ephemeral', the 'delete' option will delete the "Thinking..." message.
Ephemeral replies cannot have files.

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

Generally used alongside Command:discordcommand

The command can be ~waited for. See Language:~waitable.
Related Tags<entry[saveName].command> returns the DiscordCommandTag of a slash command upon creation, when the command is ~waited for.
Usage Example
# Use to quickly reply to a slash command interaction.
- discordinteraction reply interaction:<context.interaction> "hello!"
Usage Example
# Use to defer and reply to a slash command interaction.
- ~discordinteraction defer interaction:<context.interaction>
- discordinteraction reply interaction:<context.interaction> <context.options.get[hello].if_null[world]>
Usage Example
# Use to defer and reply to an interaction ephemerally.
- ~discordinteraction defer interaction:<context.interaction> ephemeral:true
- discordinteraction reply interaction:<context.interaction> "Shh, don't tell anyone!"
Groupexternal
RequiresdDiscordBot
Sourcehttps://github.com/DenizenScript/dDiscordBot/blob/master/src/main/java/com/denizenscript/ddiscordbot/commands/DiscordInteractionCommand.java#L31

Namediscordmessage
Related Guide Pagehttps://guide.denizenscript.com/guides/expanding/ddiscordbot.html
Syntaxdiscordmessage (id:<id>) [reply:<message>/edit:<message>/channel:<channel>/user:<user>] (<message>) (no_mention) (rows:<rows>) (embed:<embed>|...) (attach_files:<map>) (post_title:<name>)
Short DescriptionSends a message to a Discord channel.
Full DescriptionSends a message to a Discord channel.

Command may fail if the bot does not have permission within the Discord group to send a message in that channel.

You can send the message to: a channel, user, or in reply to a previous message.
If sending as a reply, optionally use "no_mention" to disable the default reply pinging the original user.

Channels can be specified as either a copied ID, or using any tag that returns a valid DiscordChannelTag.
To get IDs, enable "Developer Mode" in your Discord settings, then right click on the channel and press "Copy ID".

You can edit an existing message by using "edit:<message>".

You can use "attach_file_name:<name>" and "attach_file_text:<text>" to attach a text file with longer content than a normal message allows.
Alternatively, you can use "attach_files:<map>" to attach files as a MapTag of the name of the file to the text or a BinaryTag.

To send embeds, use "embed:<embed>|...".

You can use "rows" to attach action rows of components, such as buttons to the message, using ObjectType:DiscordButtonTag, and ObjectType:DiscordSelectionTag.

You can send a message into a Forum Channel with "post_title" specified to create a post in that forum.

The command can be ~waited for. See Language:~waitable.
Related Tags<entry[saveName].message> returns the DiscordMessageTag of the sent message, when the command is ~waited for.
<discord[mybot].group[Denizen].channel[bot-spam]> is an example of a tag that will return an appropriate channel object for a named channel in a named group.
Usage Example
# Use to message a Discord channel with a copied channel ID.
- discordmessage id:mybot channel:1234 "Hello world!"
Usage Example
# Use to reply to a message from a message received event.
- discordmessage id:mybot reply:<context.message> "Hello world!"
Usage Example
# Use to message an embed to a Discord channel.
- discordmessage id:mybot channel:1234 embed:<discord_embed[title=hi;description=this is an embed!]>
Usage Example
# Use to message a Discord channel and record the new message ID.
- ~discordmessage id:mybot channel:1234 "Hello world!" save:sent
- announce "Sent as <entry[sent].message.id>"
Usage Example
# Use to send a message to a user through a private channel.
- discordmessage id:mybot user:<[user]> "Hello world!"
Usage Example
# Use to send a short and simple text-file message to a channel.
- discordmessage id:mybot channel:<[channel]> attach_files:<map[quote.xml=<&lt>mcmonkey<&gt> haha text files amirite<n>gotta abuse em]>
Usage Example
# Use to send a message and attach a button to it.
- define my_button <discord_button.with_map[style=primary;id=my_button;label=Hello]>
- discordmessage id:mybot channel:<[channel]> rows:<[my_button]> "Hello world!"
Usage Example
# Use to send a message to a Discord channel, then edit it after 5 seconds.
- ~discordmessage id:mybot channel:<[channel]> "Hello world!" save:msg
- wait 5s
- discordmessage id:mybot edit:<entry[msg].message> "Goodbye!"
Usage Example
# Use to send multiple embeds in a single message
- ~discordmessage id:mybot channel:<[channel]> embed:<discord_embed[title=embed 1]>|<discord_embed[title=embed 2]>
Usage Example
# Use to send files in a single message, including an image file, using a MapTag.
- ~fileread path:my_information.yml save:info
- ~fileread path:my_image.png save:image
- definemap files:
    text.txt: Wow! Denizen is so cool!
    info.yml: <entry[info].data>
    my_image.png: <entry[image].data>
- ~discordmessage id:mybot channel:<[channel]> attach_files:<[files]>
Groupexternal
RequiresdDiscordBot
Sourcehttps://github.com/DenizenScript/dDiscordBot/blob/master/src/main/java/com/denizenscript/ddiscordbot/commands/DiscordMessageCommand.java#L43

Namediscordmodal
Related Guide Pagehttps://guide.denizenscript.com/guides/expanding/ddiscordbot.html
Syntaxdiscordmodal [interaction:<interaction>] [name:<name>] [rows:<rows>] (title:<title>)
Short DescriptionManages Discord modals.
Full DescriptionWith this command you can respond to an interaction using a modal.
A "modal" is a popup window that presents the user with a form to fill out.

You can specify the modal's internal name for matching with in events.
You can specify the title as text to display to the user.
You can specify rows of user-inputs using ObjectType:DiscordTextInputTag. At time of writing, Selection input is not supported.

You can listen to the responses to forms using Event:discord modal submitted.

You cannot defer an interaction before using a modal. It must be sent immediately.

Note that the interaction can be any button or application command, but cannot be a modal submission - you cannot reply to a modal submit with a second modal.

The command can be ~waited for. See Language:~waitable.
Related TagsNone
Usage Example
# Use to create a modal that only requests one single direct text input.
- definemap rows:
     1:
         1: <discord_text_input.with[id].as[textinput].with[label].as[Type here!].with[style].as[short]>
- discordmodal interaction:<context.interaction> name:example_modal title:Modal! rows:<[rows]>
Groupexternal
RequiresdDiscordBot
Sourcehttps://github.com/DenizenScript/dDiscordBot/blob/master/src/main/java/com/denizenscript/ddiscordbot/commands/DiscordModalCommand.java#L34

Namediscordreact
Related Guide Pagehttps://guide.denizenscript.com/guides/expanding/ddiscordbot.html
Syntaxdiscordreact (id:<bot>) (channel:<channel>) [message:<message>] [add/remove/clear] [reaction:<reaction>/all] (user:<user>)
Short DescriptionManages message reactions on Discord.
Full DescriptionManages message reactions on Discord.

The message can be a ObjectType:DiscordMessageTag, or just the message ID, with a channel ID also given.

You can add or remove reactions from the bot, or clear all reactions of a specific ID, or clear all reactions from a message entirely.

Reactions can be unicode symbols, or custom emoji IDs.

Optionally specify a user for 'remove' to remove only a specific user's reaction.

'Add' requires basic add-reaction permissions.
'Clear' requires 'manage messages' permission.

For custom emoji, the ID is the numeric ID. For default emoji, the ID is the unicode symbol of the emoji.
In both cases, you can copy the correct value by typing the emoji into Discord and prefixing it with a "\" symbol, like "\:myemoji:" and sending it - the sent message will show the internal form of the emoji.

The command can be ~waited for. See Language:~waitable.
Related Tags<DiscordMessageTag.reactions> Returns a list of reaction on this message.
Usage Example
# Use to react to a previously sent message.
- discordreact id:mybot message:<[some_message]> add reaction:<[my_emoji_id]>
Usage Example
# Use to remove a reaction from a previously sent message.
- discordreact id:mybot message:<[some_message]> remove reaction:<[some_reaction_emoji]>
Usage Example
# Use to clear all reactions from a message.
- discordreact id:mybot message:<[some_message]> clear reaction:all
Groupexternal
RequiresdDiscordBot
Sourcehttps://github.com/DenizenScript/dDiscordBot/blob/master/src/main/java/com/denizenscript/ddiscordbot/commands/DiscordReactCommand.java#L33

Namediscordtimeout
Related Guide Pagehttps://guide.denizenscript.com/guides/expanding/ddiscordbot.html
Syntaxdiscordtimeout (id:<bot>) ({add}/remove) [user:<user>] [group:<group>] (reason:<reason>) (duration:<duration>/{60s})
Short DescriptionPuts a user in timeout.
Full DescriptionPuts a user in timeout.

To put a user in timeout, use the "add" argument. To remove the timeout, use the "remove" argument.
The group is required for both "add" and "remove" arguments, but "reason" can only be used with "add".
Reasons show up in the group's Audit Logs.

The timeout duration defaults to 60 seconds. The duration cannot be greater than 28 days.
This argument can only be used when putting a user in timeout using the "add" argument, although it is not required.

The command can be ~waited for. See Language:~waitable.
Related Tags<DiscordUserTag.is_timed_out[<group>]> returns if the user is timed out in a certain group.
Usage Example
# Put a user in timeout.
- discordtimeout id:my_bot add user:<[user]> group:<[group]>
Usage Example
# Put a user in timeout for a duration of 3 hours with a reason.
- discordtimeout id:my_bot add user:<[user]> group:<[group]> "reason:Was being troublesome!" duration:3h
Usage Example
# Remove a user from timeout.
- discordtimeout id:my_bot remove user:<[user]> group:<[group]>
Groupexternal
RequiresdDiscordBot
Sourcehttps://github.com/DenizenScript/dDiscordBot/blob/master/src/main/java/com/denizenscript/ddiscordbot/commands/DiscordTimeoutCommand.java#L31