-1

I am creating a Discord bot to collect user information when joining a community by prompting the user to provide the required profile data.

I have the following command:

const JOIN_COMMAND = {
  name: 'join',
  description: 'User requests to join the community and need to provide his/her profile information',
  //type: 1,
  options: [
    {
      type: 3, // STRING
      name: 'name',
      description: 'Please provide your name',
      required: true,
    },
    {
      type: 4, // INTEGER
      name: 'age',
      description: 'Please provide your age',
      required: true,
      min_value: 18,
      max_value: 90
    },
    {
      type: 1, // SUB_COMMAND
      name: 'gender',
      description: 'Please provide your gender',
      //required: true,
      "options": [
        {
            "name": "male",
            "description": "Male",
            "type": 3 // 1 is type SUB_COMMAND
        },
        {
            "name": "female",
            "description": "Female",
            "type": 3
        }
      ]      
    },
  ],
  integration_types: [0, 1],
  contexts: [0, 1, 2],
};

I get the following error when using PUT to update the existing command:

{
  "message": "Invalid Form Body",
  "code": 50035,
  "errors": {
    "1": {
      "options": {
        "2": {
          "_errors": [
            {
              "code": "APPLICATION_COMMAND_OPTIONS_TYPE_INVALID",
              "message": "Sub-command and sub-command group option types are mutually exclusive to all other types"
            }
          ]
        }
      }
    }
  }
}

It's strange because there is no "sub-command group" (type: 2) in the structure.

1 Answer 1

-2
const JOIN_COMMAND = {
  name: 'join',
  description: 'User requests to join the community',
  type: 1,
  options: [
    {
        type: 3, // STRING
        name: 'name',
        description: 'Please provide your name',
        required: true,
      },
      {
        type: 4, // INTEGER
        name: 'age',
        description: 'Please provide your age',
        required: true,
        min_value: 18,
        max_value: 90
      },
      {
        type: 3, // SUB_COMMAND
        name: 'gender',
        description: 'Please provide your gender',
        required: true,
        choices: [
          {
            name: "Male",
            value: "Male"
          },
          {
            name: "Female",
            value: "Female"
          },
        ],
      },
  ],
  integration_types: [0, 1],
  contexts: [0, 1, 2],
};
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.