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...
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