Orbit Developers

Slash commands

People type / in a channel and pick one of your bot's commands from a list. Your bot gets an interaction event, reads what was asked and answers with a message.

Register your commands

PUT/bots/@me/commands

[
  { "name": "ping", "description": "Checks that the bot is awake" },
  {
    "name": "roll",
    "description": "Rolls a die",
    "options": [
      {
        "name": "sides",
        "description": "How many sides, 2 to 100",
        "type": "integer",
        "required": false
      }
    ]
  }
]

The list replaces the old one, so send all of your commands, usually when your bot starts. They show up in every server your bot is in.

  • Up to 25 commands. Names are 1โ€“32 characters of a-z, 0-9, _ and -.
  • Descriptions are 1โ€“100 characters on one line.
  • Up to 10 options per command. type is string, integer, boolean, user, channel or role, and required options come first.

GET/bots/@me/commands

Your current list.

Answer a command

When someone uses one of your commands, you get:

event: interaction
data: {"interaction_id":"1234567890123456789"}

GET/interactions/{interaction_id}

{
  "id": "1234567890123456789",
  "command": "roll",
  "options": [{ "name": "sides", "type": "integer", "value": 20 }],
  "user": {
    "id": "1234567890123456700",
    "username": "sara",
    "display_name": "Sara",
    "avatar": null,
    "bot": false
  },
  "guild_id": "1234567890123456701",
  "channel_id": "1234567890123456702",
  "created_at": 1764500000000
}

value is text, a whole number or true/false, depending on the type. For user, channel and role it's an ID from that server, and the person could see that channel. Options they left out aren't in the list.

POST/interactions/{interaction_id}/reply

{ "content": "", "embeds": [{ "title": "๐ŸŽฒ 17" }] }

The rules are the same as for sending a message, without files or replies. The message shows who used the command. Returns 201 with the message.

Each interaction gets one answer within 15 minutes. After that, or after you've answered, you get 404. Answer quickly anyway: if nothing comes back within 15 seconds, the person is told your bot didn't answer.

Good to know

  • People need SEND_MESSAGES in the channel to use a command, and your bot needs to see the channel and send messages there.
  • Option values are typed by people. Treat them like message text, see Keeping your bot safe.
  • AutoMod checks text options before your bot hears about them, and checks your answer like any message.
  • Only your bot can read or answer its interactions.