23brewert
23brewert
Explore posts from servers
DIAdiscord.js - Imagine an app
Created by 23brewert on 8/13/2024 in #djs-questions
User Context Menu in group dms - not sending interaction to gateway
No description
6 replies
DIAdiscord.js - Imagine an app
Created by 23brewert on 3/6/2024 in #djs-questions
guild.guildScheduledEventUserAdd event failing to fire consistently
I am having an issue with the guildScheduledEventUserAdd event. It seems to trigger sometimes but when I create a new event and click interested with another account it does not trigger... any ideas? also yes I have the gateway intent it works intermittently. right now it is just printing a "trigger" into the console
2 replies
DIAdiscord.js - Imagine an app
Created by 23brewert on 7/18/2023 in #djs-questions
get client from interaction
Is there a way to get the bot client from an interaction?
5 replies
DIAdiscord.js - Imagine an app
Created by 23brewert on 2/28/2023 in #djs-voice
Audio Resource Playing on Client but not on server.
When I host my bot that streams music from my website it plays but if I push it to the server it joins the vc but does not play the music. Has all the same node dependencies and does not produce any error in console. Any Ideas?
11 replies
DIAdiscord.js - Imagine an app
Created by 23brewert on 12/14/2022 in #djs-questions
How to add additional information to Buttons other than customId
I have a button handler that sends button interactions to different files depending on the customId. I was wondering if there is an additional field that I could change so that when a button with a preset customid is pressed we know that additional value?
6 replies
DIAdiscord.js - Imagine an app
Created by 23brewert on 7/15/2022 in #djs-questions
Type DiscordAPIError [discord.js]
I am trying to make a modal with a dropdown and keep getting an error. Error:
\node_modules\discord.js\src\rest\RequestHandler.js:350
throw new DiscordAPIError(data, res.status, request);
^

DiscordAPIError: Invalid Form Body
data.components[0]: Value of field "type" must be one of (1,).
at RequestHandler.execute (E:\Hexagon\hexagon-api\discordbot\node_modules\discord.js\src\rest\RequestHandler.js:350:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async RequestHandler.push (E:\Hexagon\hexagon-api\discordbot\node_modules\discord.js\src\rest\RequestHandler.js:51:14)
at async ButtonInteraction.showModal (E:\Hexagon\hexagon-api\discordbot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:240:5) {
method: 'post',
path: '/interactions/997347808371818546/aW50ZXJhY3Rpb246OTk3MzQ3ODA4MzcxODE4NTQ2OlRaSHV4SXp6aTNMVld5OXpGYnU3bDJZRGeGNuMzdCQ1NDdmZUcTJpa1Q2Vndxa09ITU1xdFNEY1dZ/callback',
code: 50035,
httpStatus: 400,
requestData: {
json: {
type: 9,
data: {
components: [
{
custom_id: 'application-selector',
disabled: false,
placeholder: 'Select the position you want to apply for.',
min_values: null,
max_values: undefined,
options: [Array],
type: 3
}
],
custom_id: 'application-modal',
title: 'Hexagon Career Application'
}
},
files: []
}
}
\node_modules\discord.js\src\rest\RequestHandler.js:350
throw new DiscordAPIError(data, res.status, request);
^

DiscordAPIError: Invalid Form Body
data.components[0]: Value of field "type" must be one of (1,).
at RequestHandler.execute (E:\Hexagon\hexagon-api\discordbot\node_modules\discord.js\src\rest\RequestHandler.js:350:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async RequestHandler.push (E:\Hexagon\hexagon-api\discordbot\node_modules\discord.js\src\rest\RequestHandler.js:51:14)
at async ButtonInteraction.showModal (E:\Hexagon\hexagon-api\discordbot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:240:5) {
method: 'post',
path: '/interactions/997347808371818546/aW50ZXJhY3Rpb246OTk3MzQ3ODA4MzcxODE4NTQ2OlRaSHV4SXp6aTNMVld5OXpGYnU3bDJZRGeGNuMzdCQ1NDdmZUcTJpa1Q2Vndxa09ITU1xdFNEY1dZ/callback',
code: 50035,
httpStatus: 400,
requestData: {
json: {
type: 9,
data: {
components: [
{
custom_id: 'application-selector',
disabled: false,
placeholder: 'Select the position you want to apply for.',
min_values: null,
max_values: undefined,
options: [Array],
type: 3
}
],
custom_id: 'application-modal',
title: 'Hexagon Career Application'
}
},
files: []
}
}
My Code:
const discordJS = require('discord.js')
const db = require('../../database')

module.exports = async function(Interaction, client){
db.query('SELECT * FROM `table`;', async function(err, positions){
if (positions[0]){
const modal = new discordJS.Modal()
modal.setCustomId('application-modal')
modal.setTitle("Hexagon Career Application")
let comps = []
let select = new discordJS.MessageSelectMenu()
select.setPlaceholder("Select the position you want to apply for.")
select.setCustomId("application-selector")
console.log(select.type)
await positions.forEach(position =>{
select.addOptions({label: position.positionName,description: position.positionDescription,value: position._id+''})
})
comps[0] = select
modal.setComponents(comps)
console.log('yep')
Interaction.showModal(modal);

}else{
Interaction.editReply({content:":x: Sorry no applications are currently open!"})
}
})
}
const discordJS = require('discord.js')
const db = require('../../database')

module.exports = async function(Interaction, client){
db.query('SELECT * FROM `table`;', async function(err, positions){
if (positions[0]){
const modal = new discordJS.Modal()
modal.setCustomId('application-modal')
modal.setTitle("Hexagon Career Application")
let comps = []
let select = new discordJS.MessageSelectMenu()
select.setPlaceholder("Select the position you want to apply for.")
select.setCustomId("application-selector")
console.log(select.type)
await positions.forEach(position =>{
select.addOptions({label: position.positionName,description: position.positionDescription,value: position._id+''})
})
comps[0] = select
modal.setComponents(comps)
console.log('yep')
Interaction.showModal(modal);

}else{
Interaction.editReply({content:":x: Sorry no applications are currently open!"})
}
})
}
4 replies