moymo,Docs
Skip to content
HTTP API Resources

Application commands ​

Application commands are what a member sees when they type / in a server your bot is in, or right-click a member or a message. You register them with your bot token; Moymo sends an interaction to your endpoint when somebody uses one. The shapes, numbers and limits are Discord's. For the guide, read Application commands.

Application command object ​

FieldTypeDescription
idUUIDThe command's id
application_idUUIDThe application it belongs to
server_id?UUIDThe server it was made for. Left out for a global command (in every server the bot is in)
typeintegerThe type
namestring1 to 32 characters. A slash command's name is lowercase letters, digits, - and _ (any alphabet), with no spaces. A context-menu command's name may have spaces and capitals
descriptionstring1 to 100 characters for a slash command. Empty for the other kinds
optionsarrayUp to 25 options, for slash commands
name_localizations?objectLocale to name ({"cs": "hod"}), with the same rules as name
description_localizations?objectLocale to description
default_member_permissions?stringA permission set as a decimal string: members need all of it in the channel to see and use the command. "0" is nobody but administrators. Left out is everybody
versionintegerGoes up every time the command changes
Example commandJSON
json
{
  "id": "3b9d5e21-8c47-4a06-b1f2-6e0a7d4c9f38",
  "application_id": "0f6c1a52-3b9e-4c1c-9d1b-6e7d2a8f4b10",
  "type": 1,
  "name": "roll",
  "description": "Roll some dice",
  "options": [
    {
      "type": 4,
      "name": "sides",
      "description": "How many sides",
      "required": true,
      "min_value": 2,
      "max_value": 100
    }
  ],
  "version": 1
}

Command types ​

NameValue
CHAT_INPUT1A slash command, typed as /roll 2d6
USER2A command on a member (right-click a member, choose it under Apps). No options
MESSAGE3A command on a message. No options

Command option object ​

FieldTypeDescription
typeintegerThe option type
namestring1 to 32 characters, lowercase letters, digits, - and _. Unique in its list
descriptionstring1 to 100 characters
requiredbooleanDefault false. Required options come before the optional ones. Not for sub-commands
choicesarrayUp to 25 { name, value } (name 1 to 100 characters). For string, integer and number options. When present these are the only valid values
autocompletebooleanYour application suggests values while the member types. Cannot be combined with choices
min_value, max_valuenumberBounds, for integer and number options
min_length, max_lengthintegerBounds on the text (0 to 6000), for string options
channel_typesarrayKinds of channel to offer: TEXT, VOICE, FORUM, TODO, DOC, CALENDAR, PARTY, GALLERY, CATEGORY
optionsarrayFor sub-commands and groups: up to 25
name_localizations, description_localizationsobjectAs on the command

Option types ​

NameValueNotes
SUB_COMMAND1/server info. A command has either sub-commands or values, never both
SUB_COMMAND_GROUP2/server roles list: groups hold sub-commands, one level deep
STRING3
INTEGER4Whole numbers between −2⁵³ and 2⁵³
BOOLEAN5
USER6A member of the server, given as an id
CHANNEL7
ROLE8
MENTIONABLE9A member or a role
NUMBER10Any number
ATTACHMENT11Not supported yet

Limits ​

Slash commands per application, per scope100
Each kind of context-menu command per application, per scope15
Everything in one command (name, description, options, choices)8000 characters
Options in a list25

A scope is "global" or "one server". A name is used once per application, per kind and per scope; registering a name that exists changes that command.

Create global command ​

POST/applications/@me/commands

Registers a command that works in every server your bot is in, or changes the one with the same name and kind. Returns 201 with the command when it is new and 200 when an existing one was changed.

RequestPOST/applications/@me/commands
bash
curl -X POST https://moymo.net/api/app/v1/applications/@me/commands \
  -H "Authorization: Bot $MOYMO_BOT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "roll",
    "description": "Roll some dice",
    "options": [{
      "type": 4,
      "name": "sides",
      "description": "How many sides",
      "required": true,
      "min_value": 2,
      "max_value": 100
    }]
  }'
js
const response = await fetch('https://moymo.net/api/app/v1/applications/@me/commands', {
  method: 'POST',
  headers: {
    Authorization: `Bot ${process.env.MOYMO_BOT_TOKEN}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'roll',
    description: 'Roll some dice',
    options: [{
      type: 4,
      name: 'sides',
      description: 'How many sides',
      required: true,
      min_value: 2,
      max_value: 100
    }]
  })
})
const command = await response.json()
python
import os
import requests

response = requests.post(
    "https://moymo.net/api/app/v1/applications/@me/commands",
    headers={"Authorization": f"Bot {os.environ['MOYMO_BOT_TOKEN']}"},
    json={
        "name": "roll",
        "description": "Roll some dice",
        "options": [{
            "type": 4,
            "name": "sides",
            "description": "How many sides",
            "required": True,
            "min_value": 2,
            "max_value": 100,
        }],
    },
)
command = response.json()
Response201CreatedJSON
json
{
  "id": "3b9d5e21-8c47-4a06-b1f2-6e0a7d4c9f38",
  "application_id": "0f6c1a52-3b9e-4c1c-9d1b-6e7d2a8f4b10",
  "type": 1,
  "name": "roll",
  "description": "Roll some dice",
  "options": [{
    "type": 4,
    "name": "sides",
    "description": "How many sides",
    "required": true,
    "min_value": 2,
    "max_value": 100
  }],
  "version": 1
}

Get global commands ​

GET/applications/@me/commands

The application's global commands.

Get global command ​

GET/applications/@me/commands/{command.id}

Edit global command ​

PATCH/applications/@me/commands/{command.id}

Changes the fields you give; the others stay. The type cannot be changed.

Delete global command ​

DELETE/applications/@me/commands/{command.id}

Returns 204.

Bulk overwrite global commands ​

PUT/applications/@me/commands

Takes a list of commands and makes the application's global commands exactly that list: new ones are added, ones whose name and kind exist are changed, the others are removed. This is the call to make when your program starts. Returns the list as it is now.

RequestPUT/applications/@me/commandsShell
bash
curl -X PUT https://moymo.net/api/app/v1/applications/@me/commands \
  -H "Authorization: Bot $MOYMO_BOT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '[
    { "name": "hello", "description": "Say hello" },
    { "name": "roll", "description": "Roll some dice" },
    { "type": 3, "name": "Quote this" }
  ]'

An empty list removes everything

PUT with [] removes all the application's global commands. Build the list from your code, not from what is already registered.

Server commands ​

The same operations for commands that exist only in one server. The bot has to be in the server, or the answer is 403.

GET/applications/@me/servers/{server.id}/commands
POST/applications/@me/servers/{server.id}/commands
PUT/applications/@me/servers/{server.id}/commands
GET/applications/@me/servers/{server.id}/commands/{command.id}
PATCH/applications/@me/servers/{server.id}/commands/{command.id}
DELETE/applications/@me/servers/{server.id}/commands/{command.id}

What a member sees ​

A command shows in the slash menu only when the application has a verified interactions endpoint, the bot is in the server, and the member has the permissions in default_member_permissions in that channel. You can look at everything an application has registered, and remove a command, on the Commands tab of the portal.

The wiki is for Moymo's members and developers. Something wrong or missing? Use "Suggest a change" on any page.