Commands and components
guideWhat changes for slash, context and text commands, buttons, dropdowns, modals and Components V2 when you port a DiSky 4 script.
This page lists what to change in a DiSky 4 script that declares commands or sends components. You're assumed to have a bot named "my-bot" logged in and to know the DiSky 4 syntax you're porting from.
Slash and context commands
This is the biggest change. In DiSky 4 a slash command, user command or message command structure registered itself on Discord when the bot connected. In DiSky 5 these structures are models only: loading, reloading or unloading one never touches Discord. Nothing appears until a script runs update the discord commands (full replace) or register the discord command (upsert), typically from on guild ready or on ready. See Registering commands.
The bot: and guilds: entries no longer exist: they are load errors, so delete them. The target bot and guild come from the registration call. Arguments change from <type="name"> to <name: type>, and the value is also readable as {_name}.
DiSky 4:
slash command ban <member="target"> [<string="reason">]: bot: "my-bot" guilds: 123456789012345678 description: Ban a member enabled for: ban members arguments: target: Who to ban reason: Why trigger: defer the interaction reply with "Banned %arg-1% (%arg-2%)"
DiSky 5 (the bot is already logged in; see Starting a bot):
slash command ban <target: member> [<reason: string>]: description: Ban a member enabled for: ban members arguments: target: Who to ban reason: Why trigger: defer the interaction reply with "Banned %{_target}% (%{_reason}%)" on guild ready: update the discord commands (all structured application commands) in event-guild
update replaces the whole list of that guild or bot, so one call must carry every structure: all structured application commands collects every slash, user and message command. Use globally in event-bot from on ready for global commands. Context commands follow the same rule; only their entries differ:
user command Report user: trigger: reply with hidden "Reported %target user%"
Commands built at runtime keep working with new spellings: the word new is now required (a new slash command named "greet" with description "..."), the required and autocomplete flags become set required of {_opt} to true, and locale data objects are replaced by the localize effect. See Command builders and Slash options.
DiSky 4 | DiSky 5 | Note |
|---|---|---|
| removed | Load error; pass the bot or guild to the registration effect |
|
| Name first, Skript type second; no default values on slash arguments |
| optional | Omit it when no argument needs a description |
|
|
|
|
| Also accepts |
|
| Same meaning |
|
| The word |
|
|
|
|
| Locale data objects are gone |
|
| Property on the command |
|
| Matters for |
Text commands
The discord command structure keeps its header and its entries (aliases, roles, permissions, bots, executable in, prefixes, usage, description, category, permission message, trigger). Arguments keep the same positional form (<member>, arg-1); a named form <who: member> now also fills {_who}.
One thing reads differently. DiSky 4 split the first character of the name off as the prefix when no prefixes: entry was given. DiSky 5 gives the command an empty prefix and matches the whole name, so discord command !ping still answers to !ping. Nothing breaks, but the command's name is now !ping and used prefix is empty. Declare prefixes: "!" on discord command ping if a script reads the name or the prefix separately.
DiSky 4:
discord command slow: prefixes: ! guild cooldown: 10 seconds cooldown message: You must wait trigger: reply with "ok" on disky command: cancel event
DiSky 5:
discord command slow: prefixes: "!" cooldown: 10 seconds cooldown scope: guild cooldown message: "Wait %remaining cooldown% before using this again." trigger: reply with "ok" on discord command used: cancel event
prefixes is now an expression evaluated per message, so quote text values. See Declaring a command, Restricting a command and Listing and events.
DiSky 4 | DiSky 5 | Note |
|---|---|---|
| same line | Still answers to |
|
| Quote the values |
|
| May use |
|
| The scope is |
(none) |
| Sent on invalid arguments |
|
| Cancellable; |
|
| No text event value |
|
| Hyphen forms no longer parse |
Components and interactions
Buttons, dropdowns, rows, containers and modals are now editable holders: event-button and event-dropdown can be changed and handed back, and the built component is a snapshot. A row is optional; a button added to the components of a message joins the last row that has room, and a dropdown gets its own. Any Components V2 component switches the message to V2 on its own. See Sending messages.
Several optional words became required, and the label type is gone: every modal input takes its label in its constructor (labeled "...") and has a description. The apply component replacement section has no equivalent; replace components one at a time.
DiSky 4:
on button clicked: if clicked button is "yes": edit button of the event to show new success button with id "yes" named "Done" set {_modal} to a new modal with id "form" named "Feedback" set {_input} to a new short text input with id "title" set {_label} to new label "Feedback Title" with {_input} add {_label} to rows of {_modal} show {_modal}
DiSky 5:
on button clicked: if clicked id is "yes": set label of event-button to "Done" replace the component with id "yes" of event-message with event-button else if clicked id is "open": set {_modal} to a new modal with id "form" titled "Feedback" set {_input} to a new short text input with id "title" labeled "Feedback Title" add {_input} to components of {_modal} show {_modal}
replace the component with id ... swaps one component. edit interaction components replaces every component of the message, and needs defer the interaction and edit first. reply with no longer stores the message and has no content: entry: build a message with a new message with content "..." in %channel%, attach components with add ... to components of {_m}, then reply with {_m}; a bare component can be replied directly.
DiSky 4 | DiSky 5 | Note |
|---|---|---|
|
|
|
|
| Swaps one component |
|
| Works on any component; |
| removed | Replace components one by one |
|
|
|
|
| The word |
|
| Takes the |
|
| The |
|
| Also works on rows, containers and modals |
|
| An expression; |
|
| Property name shortened |
edit [the] interaction components (with|to [show]) [the] [components] %-components%Replaces every component of the message whose button or dropdown was just clicked, as the answer to that interaction (or through it, if it was deferred 'and edit').