Acemavie
DIAdiscord.js - Imagine an app
•Created by Acemavie on 3/11/2024 in #djs-questions
Adding role to a user
I have a function that should add a role to a user.
I am calling it using this line:
And I am also import client from the index.js file which module.exports the client. But When running that function I get this error:
Error assigning role: Cannot read properties of undefined (reading 'cache')
(node:41004) 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/10/2024 in #djs-questions
Collectro recieved no interaction before ending with reason: time
I have a signup modal that has a collector on it. But I don't know how to prevent it from crashing if the time expires.
const submit = await interaction.awaitModalSubmit({
filter: (interaction) => interaction.isModalSubmit() && interaction.customId === 'signup_modal',
time: 60000
});
const minecraftUsername = await submit.fields.getTextInputValue('minecraftusername');
const event = db.get(
await submit.reply("You have successfully signed up for the event.");
const minecraftUsername = await submit.fields.getTextInputValue('minecraftusername');
const event = db.get(
events.${eventId}
);
if (!event) {
return await submit.reply("Event not found. Please try again.");
}
event.participants = event.participants || [];
event.participants.push({ userId, minecraftUsername });
db.set(events.${eventId}
, event);
await submit.reply("You have successfully signed up for the event.");
32 replies
DIAdiscord.js - Imagine an app
•Created by Acemavie on 3/7/2024 in #djs-questions
Modal submission help
I am trying to make a modal that asks for your minecraft username and then put it to the database. The modal opens successfully with my one field. But when I click submit it says interaction failed. I couldn't find something in the docs either. No errors in console.
The code: https://pastebin.com/BiURBb6R
59 replies
DIAdiscord.js - Imagine an app
•Created by Acemavie on 3/7/2024 in #djs-questions
Can you use variable in embedBuilder name and description?
I have a embedBuilder instance and It doesn't seem to work.
const embed = new EmbedBuilder()
.setTitle(name)
.setDescription(description)
.setColor('#0099ff');
The error is as follows:
R:\Developer\Discord bots\Foxia\Foxia Events\node_modules@sapphire\shapeshift\dist\cjs\index.cjs:1854
return Result.err(new CombinedError(errors));
^
CombinedError: Received one or more errors
at _UnionValidator.handle (R:\Developer\Discord bots\Foxia\Foxia Events\node_modules@sapphire\shapeshift\dist\cjs\index.cjs:1854:23)
at _UnionValidator.parse (R:\Developer\Discord bots\Foxia\Foxia Events\node_modules@sapphire\shapeshift\dist\cjs\index.cjs:939:90)
at EmbedBuilder.setTitle (R:\Developer\Discord bots\Foxia\Foxia Events\node_modules@discordjs\builders\dist\index.js:373:20)
at sendEventEmbed (R:\Developer\Discord bots\Foxia\Foxia Events\src\functions\event\eventEmbed.js:24:10)
at Object.<anonymous> (R:\Developer\Discord bots\Foxia\Foxia Events\index.js:13:83)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
errors: [
ExpectedValidationError: Expected values to be equals
at _LiteralValidator.handle (R:\Developer\Discord bots\Foxia\Foxia Events\node_modules@sapphire\shapeshift\dist\cjs\index.cjs:1485:76)
at _LiteralValidator.run (R:\Developer\Discord bots\Foxia\Foxia Events\node_modules@sapphire\shapeshift\dist\cjs\index.cjs:925:23)
at _UnionValidator.handle (R:\Developer\Discord bots\Foxia\Foxia Events\node_modules@sapphire\shapeshift\dist\cjs\index.cjs:1849:32)
at _UnionValidator.parse (R:\Developer\Discord bots\Foxia\Foxia Events\node_modules@sapphire\shapeshift\dist\cjs\index.cjs:939:90)
at EmbedBuilder.setTitle (R:\Developer\Discord bots\Foxia\Foxia Events\node_modules@discordjs\builders\dist\index.js:373:20)
at sendEventEmbed (R:\Developer\Discord bots\Foxia\Foxia Events\src\functions\event\eventEmbed.js:24:10)
at Object.<anonymous> (R:\Developer\Discord bots\Foxia\Foxia Events\index.js:13:83)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32) {
validator: 's.literal(V)',
given: undefined,
expected: null
},
ValidationError: Expected a string primitive
at _StringValidator.handle (R:\Developer\Discord bots\Foxia\Foxia Events\node_modules@sapphire\shapeshift\dist\cjs\index.cjs:2473:70)
at _StringValidator.run (R:\Developer\Discord bots\Foxia\Foxia Events\node_modules@sapphire\shapeshift\dist\cjs\index.cjs:925:23)
at _UnionValidator.handle (R:\Developer\Discord bots\Foxia\Foxia Events\node_modules@sapphire\shapeshift\dist\cjs\index.cjs:1849:32)
at _UnionValidator.parse (R:\Developer\Discord bots\Foxia\Foxia Events\node_modules@sapphire\shapeshift\dist\cjs\index.cjs:939:90)
at EmbedBuilder.setTitle (R:\Developer\Discord bots\Foxia\Foxia Events\node_modules@discordjs\builders\dist\index.js:373:20)
at sendEventEmbed (R:\Developer\Discord bots\Foxia\Foxia Events\src\functions\event\eventEmbed.js:24:10)
at Object.<anonymous> (R:\Developer\Discord bots\Foxia\Foxia Events\index.js:13:83)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32) {
validator: 's.string',
given: undefined
}
]
}
Node.js v18.17.1
6 replies
DIAdiscord.js - Imagine an app
•Created by Acemavie on 9/11/2023 in #djs-questions
SlashCommandBuilder error
![](https://cdn.answeroverflow.com/1150793968448176239/image.png)
17 replies
DIAdiscord.js - Imagine an app
•Created by Acemavie on 11/8/2022 in #djs-questions
Need help with NaN
![](https://utfs.io/f/51a2b067-696a-418d-a25f-616cf9ab8cf4-1nq2cb.png)
4 replies