discord-interactions
discord-interactions copied to clipboard
default option error
When using default option in a slash-command option an error is thrown: "code":"APPLICATION_COMMAND_OPTIONS_DEFAULT_INVALID","message":"There can be 1 default option within command, sub-command, and sub-command group options" Even tho there is just one options with default: true setting.
Example options array:
options: [
{
type: 3,
default: true,
required: true,
name: "Twitter Handle",
description: "Twitter @ handle to retrieve tweets from."
},
{
type: 4,
required: true,
name: "Quantity",
description: "Number of tweets to return from the given handle.",
choices: [
{ name: "One", value: 1 },
{ name: "Two", value: 2 },
{ name: "Three", value: 3 },
{ name: "Four", value: 4 },
{ name: "Five", value: 5 },
]
}
],
I'll take a look at that as soon as i have the time. Meanwhile if possible provide the full error response you got.
Full error response
{
config: {
url: 'https://discord.com/api/v8/applications/548629922457976833/guilds/547523570813632514/commands/791072258486698014',
method: 'patch',
data: '{"name":"twitter","description":"Retrieve tweet(s) from specified user.","options":[{"type":3,"default":true,"required":true,"name":"Handle","description":"Twitter handle to retrieve tweets from. (No leading @ required)"},{"type":4,"required":true,"name":"Quantity","description":"Number of tweets to return from the given handle.","choices":[{"name":"One","value":1},{"name":"Two","value":2},{"name":"Three","value":3},{"name":"Four","value":4},{"name":"Five","value":5}]}]}',
headers: {
Accept: 'application/json, text/plain, */*',
'Content-Type': 'application/json;charset=utf-8',
Authorization: 'Bot NTQ4NjI5OTIyNDU3OTc2ODMz.XHB1bg.lx6rqlUs5g6TJ07SfBpbaB52jgg',
'User-Agent': 'axios/0.21.1',
'Content-Length': 475
},
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
adapter: [Function: httpAdapter],
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: [Function: validateStatus]
},
request: <ref *1> ClientRequest {
_events: [Object: null prototype] {
socket: [Function (anonymous)],
abort: [Function (anonymous)],
aborted: [Function (anonymous)],
connect: [Function (anonymous)],
error: [Function (anonymous)],
timeout: [Function (anonymous)],
prefinish: [Function: requestOnPrefinish]
},
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
_closed: false,
socket: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: false,
_SNICallback: null,
servername: 'discord.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 10,
connecting: false,
_hadError: false,
_parent: null,
_host: 'discord.com',
_readableState: [ReadableState],
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: [TLSWrap],
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular *1],
[Symbol(res)]: [TLSWrap],
[Symbol(verified)]: true,
[Symbol(pendingSession)]: null,
[Symbol(async_id_symbol)]: 249,
[Symbol(kHandle)]: [TLSWrap],
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(connect-options)]: [Object],
[Symbol(RequestTimeout)]: undefined
},
_header: 'PATCH /api/v8/applications/548629922457976833/guilds/547523570813632514/commands/791072258486698014 HTTP/1.1\r\n' +
'Accept: application/json, text/plain, */*\r\n' +
'Content-Type: application/json;charset=utf-8\r\n' +
'Authorization: Bot NTQ4NjI5OTIyNDU3OTc2ODMz.XHB1bg.lx6rqlUs5g6TJ07SfBpbaB52jgg\r\n' +
'User-Agent: axios/0.21.1\r\n' +
'Content-Length: 475\r\n' +
'Host: discord.com\r\n' +
'Connection: close\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: noopPendingOutput],
agent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object],
requests: {},
sockets: [Object],
freeSockets: {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
scheduling: 'fifo',
maxTotalSockets: Infinity,
totalSocketCount: 1,
maxCachedSessions: 100,
_sessionCache: [Object],
[Symbol(kCapture)]: false
},
socketPath: undefined,
method: 'PATCH',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: '/api/v8/applications/548629922457976833/guilds/547523570813632514/commands/791072258486698014',
_ended: true,
res: IncomingMessage {
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 3,
_maxListeners: undefined,
socket: [TLSSocket],
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
rawHeaders: [Array],
rawTrailers: [],
aborted: false,
upgrade: false,
url: '',
method: null,
statusCode: 400,
statusMessage: 'Bad Request',
client: [TLSSocket],
_consuming: false,
_dumped: false,
req: [Circular *1],
responseUrl: 'https://discord.com/api/v8/applications/548629922457976833/guilds/547523570813632514/commands/791072258486698014',
redirects: [],
[Symbol(kCapture)]: false,
[Symbol(kHeaders)]: [Object],
[Symbol(kHeadersCount)]: 32,
[Symbol(kTrailers)]: null,
[Symbol(kTrailersCount)]: 0,
[Symbol(RequestTimeout)]: undefined
},
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'discord.com',
protocol: 'https:',
_redirectable: Writable {
_writableState: [WritableState],
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
_options: [Object],
_ended: true,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 475,
_requestBodyBuffers: [],
_onNativeResponse: [Function (anonymous)],
_currentRequest: [Circular *1],
_currentUrl: 'https://discord.com/api/v8/applications/548629922457976833/guilds/547523570813632514/commands/791072258486698014',
[Symbol(kCapture)]: false
},
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype] {
accept: [Array],
'content-type': [Array],
authorization: [Array],
'user-agent': [Array],
'content-length': [Array],
host: [Array]
}
},
response: {
status: 400,
statusText: 'Bad Request',
headers: {
date: 'Tue, 22 Dec 2020 22:41:02 GMT',
'content-type': 'application/json',
'content-length': '252',
connection: 'close',
'set-cookie': [Array],
'strict-transport-security': 'max-age=31536000; includeSubDomains; preload',
'x-envoy-upstream-service-time': '82',
via: '1.1 google',
'cf-cache-status': 'DYNAMIC',
'cf-request-id': '072e3600c4000026b776184000000001',
'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
'report-to': '{"endpoints":[{"url":"https:\\/\\/a.nel.cloudflare.com\\/report?s=X%2F0ZQg4spbWvIyjNXVan1UUtUh8LnT0hdeN246bGTlW8gZViOehgPkBxltIkRc8VtVRR8pKpkemSP3gK4Z4CepIxUgWEceZ9iRCj9g%3D%3D"}],"group":"cf-nel","max_age":604800}',
nel: '{"report_to":"cf-nel","max_age":604800}',
'x-content-type-options': 'nosniff',
server: 'cloudflare',
'cf-ray': '605d59146a2d26b7-MSP'
},
config: {
url: 'https://discord.com/api/v8/applications/548629922457976833/guilds/547523570813632514/commands/791072258486698014',
method: 'patch',
data: '{"name":"twitter","description":"Retrieve tweet(s) from specified user.","options":[{"type":3,"default":true,"required":true,"name":"Handle","description":"Twitter handle to retrieve tweets from. (No leading @ required)"},{"type":4,"required":true,"name":"Quantity","description":"Number of tweets to return from the given handle.","choices":[{"name":"One","value":1},{"name":"Two","value":2},{"name":"Three","value":3},{"name":"Four","value":4},{"name":"Five","value":5}]}]}',
headers: [Object],
transformRequest: [Array],
transformResponse: [Array],
timeout: 0,
adapter: [Function: httpAdapter],
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: [Function: validateStatus]
},
request: <ref *1> ClientRequest {
_events: [Object: null prototype],
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
_closed: false,
socket: [TLSSocket],
_header: 'PATCH /api/v8/applications/548629922457976833/guilds/547523570813632514/commands/791072258486698014 HTTP/1.1\r\n' +
'Accept: application/json, text/plain, */*\r\n' +
'Content-Type: application/json;charset=utf-8\r\n' +
'Authorization: Bot NTQ4NjI5OTIyNDU3OTc2ODMz.XHB1bg.lx6rqlUs5g6TJ07SfBpbaB52jgg\r\n' +
'User-Agent: axios/0.21.1\r\n' +
'Content-Length: 475\r\n' +
'Host: discord.com\r\n' +
'Connection: close\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
method: 'PATCH',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: '/api/v8/applications/548629922457976833/guilds/547523570813632514/commands/791072258486698014',
_ended: true,
res: [IncomingMessage],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'discord.com',
protocol: 'https:',
_redirectable: [Writable],
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
data: { code: 50035, errors: [Object], message: 'Invalid Form Body' }
},
isAxiosError: true,
toJSON: [Function: toJSON]
}
data.errors information:
{
"options": {
"0": {
"_errors": [
{
"code": "APPLICATION_COMMAND_OPTIONS_DEFAULT_INVALID",
"message": "There can be 1 default option within command, sub-command, and sub-command group options"
}
]
}
}
}
Alright ill take a look at it ty.
@0zzer Can u send your data(Slash command config json)