Acemavie
Acemavie
DIAdiscord.js - Imagine an app
Created by Acemavie on 3/11/2024 in #djs-questions
Adding role to a user
I just needed to pass the client to the assignRole function
11 replies
DIAdiscord.js - Imagine an app
Created by Acemavie on 3/11/2024 in #djs-questions
Adding role to a user
Oh, I got it working
11 replies
DIAdiscord.js - Imagine an app
Created by Acemavie on 3/11/2024 in #djs-questions
Adding role to a user
Error assigning role: Cannot read properties of undefined (reading 'cache') (node:1452) Warning: Accessing non-existent property 'guilds' of module exports inside circular dependency (Use node --trace-warnings ... to show where the warning was created)
11 replies
DIAdiscord.js - Imagine an app
Created by Acemavie on 3/11/2024 in #djs-questions
Adding role to a user
I tried putting the assignRole function in the index.js file and importing that but then I get the error: Error choosing participants: assignRole is not a function
11 replies
DIAdiscord.js - Imagine an app
Created by Acemavie on 3/11/2024 in #djs-questions
Adding role to a user
const { SlashCommandBuilder } = require('discord.js');
const chooseParticipants = require('../../utils/chooseParticipants');

module.exports = {
data: new SlashCommandBuilder()
.setName('choose')
.setDescription('Choose participants for an event (raffle)')
.addStringOption(option =>
option.setName('id')
.setDescription('ID of the event')
.setRequired(true))
.addIntegerOption(option =>
option.setName('amount')
.setDescription('Number of participants to choose')
.setRequired(true)),

async execute(interaction) {
const eventId = interaction.options.getString('id');
const amount = interaction.options.getInteger('amount');

// Choose participants
const result = await chooseParticipants(eventId, amount);

if (result.success) {
const chosenParticipants = result.chosenParticipants.map(participant => participant.minecraftUsername);
const message = `Chosen participants: ${chosenParticipants.join(', ')}`;
await interaction.reply(message);
} else {
await interaction.reply({ content: result.message, ephemeral: true });
}
}
};
const { SlashCommandBuilder } = require('discord.js');
const chooseParticipants = require('../../utils/chooseParticipants');

module.exports = {
data: new SlashCommandBuilder()
.setName('choose')
.setDescription('Choose participants for an event (raffle)')
.addStringOption(option =>
option.setName('id')
.setDescription('ID of the event')
.setRequired(true))
.addIntegerOption(option =>
option.setName('amount')
.setDescription('Number of participants to choose')
.setRequired(true)),

async execute(interaction) {
const eventId = interaction.options.getString('id');
const amount = interaction.options.getInteger('amount');

// Choose participants
const result = await chooseParticipants(eventId, amount);

if (result.success) {
const chosenParticipants = result.chosenParticipants.map(participant => participant.minecraftUsername);
const message = `Chosen participants: ${chosenParticipants.join(', ')}`;
await interaction.reply(message);
} else {
await interaction.reply({ content: result.message, ephemeral: true });
}
}
};
11 replies
DIAdiscord.js - Imagine an app
Created by Acemavie on 3/11/2024 in #djs-questions
Adding role to a user
from a command file
11 replies
DIAdiscord.js - Imagine an app
Created by Acemavie on 3/11/2024 in #djs-questions
Adding role to a user
11 replies
DIAdiscord.js - Imagine an app
Created by Acemavie on 3/11/2024 in #djs-questions
Adding role to a user
It's a function for a function which is for a command
11 replies
DIAdiscord.js - Imagine an app
Created by Acemavie on 3/11/2024 in #djs-questions
Adding role to a user
What do you mean by, What is the context you call that function in?
11 replies
DIAdiscord.js - Imagine an app
Created by Acemavie on 3/10/2024 in #djs-questions
Collectro recieved no interaction before ending with reason: time
Thanks alot, I got my issue fixed!
32 replies
DIAdiscord.js - Imagine an app
Created by Acemavie on 3/10/2024 in #djs-questions
Collectro recieved no interaction before ending with reason: time
Oh
32 replies
DIAdiscord.js - Imagine an app
Created by Acemavie on 3/10/2024 in #djs-questions
Collectro recieved no interaction before ending with reason: time
But I'll read it again
32 replies
DIAdiscord.js - Imagine an app
Created by Acemavie on 3/10/2024 in #djs-questions
Collectro recieved no interaction before ending with reason: time
I did when I was creating the modal. I t worked originally until I tried fixing the button issue
32 replies
DIAdiscord.js - Imagine an app
Created by Acemavie on 3/10/2024 in #djs-questions
Collectro recieved no interaction before ending with reason: time
ActionRowBuilder?
32 replies
DIAdiscord.js - Imagine an app
Created by Acemavie on 3/10/2024 in #djs-questions
Collectro recieved no interaction before ending with reason: time
32 replies
DIAdiscord.js - Imagine an app
Created by Acemavie on 3/10/2024 in #djs-questions
Collectro recieved no interaction before ending with reason: time
I got that error when clicking the button now
32 replies
DIAdiscord.js - Imagine an app
Created by Acemavie on 3/10/2024 in #djs-questions
Collectro recieved no interaction before ending with reason: time
node:events:492
throw er; // Unhandled 'error' event
^

DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[BASE_TYPE_BAD_LENGTH]: Must be between 1 and 5 in length.
at handleErrors (R:\1) Developer\Discord bots\Foxia\Foxia Events\node_modules\@discordjs\rest\dist\index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (R:\1) Developer\Discord bots\Foxia\Foxia Events\node_modules\@discordjs\rest\dist\index.js:826:23)
at async _REST.request (R:\1) Developer\Discord bots\Foxia\Foxia Events\node_modules\@discordjs\rest\dist\index.js:1266:22)
at async ButtonInteraction.showModal (R:\1) Developer\Discord bots\Foxia\Foxia Events\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:253:5)
at async handleSignup (R:\1) Developer\Discord bots\Foxia\Foxia Events\src\utils\signup.js:34:5)
at async Object.execute (R:\1) Developer\Discord bots\Foxia\Foxia Events\src\events\client\interactionCreate.js:31:25)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:395:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
requestBody: {
files: undefined,
json: {
type: 9,
data: {
custom_id: 'signup_modal',
title: 'Sign Up',
components: [ { type: 1, data: [Object], components: [] } ]
}
}
},
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: {
data: { components: { '0': { components: [Object] } } }
}
},
code: 50035,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1216337739591716885/aW50ZXJhY3Rpb246MTIxNjMzNzczOTU5MTcxNjg4NTpBYVRPdG9KbmZSM0lSc0NKQjdvS1RrZWI0MEFWY2dqSUl4ZHJrVWp6cGxsMzhVcmFuQ0hsYWJ2ZXUwM3lTR0VrNXAzdHNsQnlOOUJNVDZTZWRiVGtoZHZITEdEVkQ2eEl5b1BoQjNTbVBib1RMT0llZUs5MktQUWZmZ3hWQ1lEcQ/callback'
}

Node.js v18.17.1
node:events:492
throw er; // Unhandled 'error' event
^

DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[BASE_TYPE_BAD_LENGTH]: Must be between 1 and 5 in length.
at handleErrors (R:\1) Developer\Discord bots\Foxia\Foxia Events\node_modules\@discordjs\rest\dist\index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (R:\1) Developer\Discord bots\Foxia\Foxia Events\node_modules\@discordjs\rest\dist\index.js:826:23)
at async _REST.request (R:\1) Developer\Discord bots\Foxia\Foxia Events\node_modules\@discordjs\rest\dist\index.js:1266:22)
at async ButtonInteraction.showModal (R:\1) Developer\Discord bots\Foxia\Foxia Events\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:253:5)
at async handleSignup (R:\1) Developer\Discord bots\Foxia\Foxia Events\src\utils\signup.js:34:5)
at async Object.execute (R:\1) Developer\Discord bots\Foxia\Foxia Events\src\events\client\interactionCreate.js:31:25)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:395:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
requestBody: {
files: undefined,
json: {
type: 9,
data: {
custom_id: 'signup_modal',
title: 'Sign Up',
components: [ { type: 1, data: [Object], components: [] } ]
}
}
},
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: {
data: { components: { '0': { components: [Object] } } }
}
},
code: 50035,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1216337739591716885/aW50ZXJhY3Rpb246MTIxNjMzNzczOTU5MTcxNjg4NTpBYVRPdG9KbmZSM0lSc0NKQjdvS1RrZWI0MEFWY2dqSUl4ZHJrVWp6cGxsMzhVcmFuQ0hsYWJ2ZXUwM3lTR0VrNXAzdHNsQnlOOUJNVDZTZWRiVGtoZHZITEdEVkQ2eEl5b1BoQjNTbVBib1RMT0llZUs5MktQUWZmZ3hWQ1lEcQ/callback'
}

Node.js v18.17.1
32 replies
DIAdiscord.js - Imagine an app
Created by Acemavie on 3/10/2024 in #djs-questions
Collectro recieved no interaction before ending with reason: time
interaction.on is not a function
32 replies
DIAdiscord.js - Imagine an app
Created by Acemavie on 3/10/2024 in #djs-questions
Collectro recieved no interaction before ending with reason: time
I just realized that too when I tried to click on the button
32 replies
DIAdiscord.js - Imagine an app
Created by Acemavie on 3/10/2024 in #djs-questions
Collectro recieved no interaction before ending with reason: time
No description
32 replies