Add field to Guild Rest

Hi ! I want to know, with Discord.JS, there is a way to add extra fields to Guild Rest Request ? To explain, I want to add field for Rules Screening (de-documented) with an extra package created by me. https://github.com/discord/discord-api-docs/commit/decd6343a5b03c6622d91a64383cf644594e486e Thanks in advance ^^ Mysterious_Dev
4 Replies
d.js toolkit
d.js toolkit2y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Mysterious_Dev
Mysterious_DevOP2y ago
Yeah, but it's been dedocumented for 2 years already and I say that even if it changes tomorrow, well I would have already learned how to do that in this case ^^. I keep this thread open until I success. Thanks anyway ^^ Hello ! When I try to modify the membership screening, I get this error and I don't know why :/ My code :
const bodyRules = [];

bodyRules.push({
enabled: true,
form_fields: [
{
field_type: "TERMS",
label: "Read and agree to the server rules",
values: [
"Treat everyone with respect. Absolutely no harassment, witch hunting, sexism, racism, or hate speech will be tolerated.",
"No spam or self-promotion (server invites, advertisements, etc) without permission from a staff member. This includes DMing fellow members."
],
required: true
}
],
description: "Test Server"
});

await rest.patch(`/guilds/${GUILD_ID}/member-verification`, { body: bodyRules });
const bodyRules = [];

bodyRules.push({
enabled: true,
form_fields: [
{
field_type: "TERMS",
label: "Read and agree to the server rules",
values: [
"Treat everyone with respect. Absolutely no harassment, witch hunting, sexism, racism, or hate speech will be tolerated.",
"No spam or self-promotion (server invites, advertisements, etc) without permission from a staff member. This includes DMing fellow members."
],
required: true
}
],
description: "Test Server"
});

await rest.patch(`/guilds/${GUILD_ID}/member-verification`, { body: bodyRules });
The error :
[DICT_TYPE_CONVERT]: Only dictionaries may be used in a DictType
at handleErrors (C:\Les-Moddeurs-Francais\Moddeur-Ultime\node_modules\@discordjs\rest\dist\index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (C:\Les-Moddeurs-Francais\Moddeur-Ultime\node_modules\@discordjs\rest\dist\index.js:1021:23)
at async SequentialHandler.queueRequest (C:\Les-Moddeurs-Francais\Moddeur-Ultime\node_modules\@discordjs\rest\dist\index.js:862:14)
at async REST.request (C:\Les-Moddeurs-Francais\Moddeur-Ultime\node_modules\@discordjs\rest\dist\index.js:1387:22) {
requestBody: { files: undefined, json: [ [Object] ] },
rawError: {
code: 50035,
errors: { _errors: [Array] },
message: 'Invalid Form Body'
},
code: 50035,
status: 400,
method: 'PATCH',
url: 'https://discord.com/api/v10/guilds/GuildID/member-verification'
}
[DICT_TYPE_CONVERT]: Only dictionaries may be used in a DictType
at handleErrors (C:\Les-Moddeurs-Francais\Moddeur-Ultime\node_modules\@discordjs\rest\dist\index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (C:\Les-Moddeurs-Francais\Moddeur-Ultime\node_modules\@discordjs\rest\dist\index.js:1021:23)
at async SequentialHandler.queueRequest (C:\Les-Moddeurs-Francais\Moddeur-Ultime\node_modules\@discordjs\rest\dist\index.js:862:14)
at async REST.request (C:\Les-Moddeurs-Francais\Moddeur-Ultime\node_modules\@discordjs\rest\dist\index.js:1387:22) {
requestBody: { files: undefined, json: [ [Object] ] },
rawError: {
code: 50035,
errors: { _errors: [Array] },
message: 'Invalid Form Body'
},
code: 50035,
status: 400,
method: 'PATCH',
url: 'https://discord.com/api/v10/guilds/GuildID/member-verification'
}
Mysterious_Dev
Mysterious_DevOP2y ago
Mysterious_Dev
Mysterious_DevOP2y ago
Hmmm okay, thanks anyway ^^
Want results from more Discord servers?
Add your server