brokenrecord388
brokenrecord388
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 10/6/2024 in #djs-questions
Unknown interaction
Hey! This is a bit of a weird issue, the code that wraps my dropdowns is quite difficult to pick apart on the backend to be able to post here, but this is what's in the active bit, should be relatively easy to understand.
this.eventLengthDropdown = this.cache.storage.registerDropdown("eventLengthDropdown:" + this.id, async (cache: Cache, interaction: AnySelectMenuInteraction) => {
if (interaction.values[0] === "-1") {
await interaction.showModal(this.getLengthModal());
return;
}

if (!interaction.values[0]) return;

interaction.deferUpdate().catch(err => cache.handleError(err, true));
this.data.length = parseInt(interaction.values[0]);
this.update();
});

private getLengthModal() {
const modal = new ModalBuilder()
.setCustomId("schedulingEventEditLengthModal:" + this.id)
.setTitle("Edit Length");

modal.addComponents(
new ActionRowBuilder<ModalActionRowComponentBuilder>().addComponents(new TextInputBuilder()
.setCustomId("length")
.setLabel("Length (in mins)")
.setRequired(true)
.setValue(this.data.length.toString())
.setStyle(TextInputStyle.Short))
);

return modal;
}
this.eventLengthDropdown = this.cache.storage.registerDropdown("eventLengthDropdown:" + this.id, async (cache: Cache, interaction: AnySelectMenuInteraction) => {
if (interaction.values[0] === "-1") {
await interaction.showModal(this.getLengthModal());
return;
}

if (!interaction.values[0]) return;

interaction.deferUpdate().catch(err => cache.handleError(err, true));
this.data.length = parseInt(interaction.values[0]);
this.update();
});

private getLengthModal() {
const modal = new ModalBuilder()
.setCustomId("schedulingEventEditLengthModal:" + this.id)
.setTitle("Edit Length");

modal.addComponents(
new ActionRowBuilder<ModalActionRowComponentBuilder>().addComponents(new TextInputBuilder()
.setCustomId("length")
.setLabel("Length (in mins)")
.setRequired(true)
.setValue(this.data.length.toString())
.setStyle(TextInputStyle.Short))
);

return modal;
}
The intention here is that the dropdown has various values (15, 30, 45, 60, 90, 120, -1). If the value is -1, then it's supposed to show a modal in response, however about 70% of the time (not all the time), it gives me an "Unknown interaction" error. This does not happen when the values[0] is not -1. Does anyone know why showing the modal gives an unknown interaction? If there's any explanations to various parts you need, let me know. Djs: 14.8.0
25 replies
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 7/20/2023 in #djs-voice
Huge error whilst trying to install opus
Hi! I'm trying to install opus on my bot, but when I run the npm install command, I get the biggest error I've ever seen. Usually I'm good with understanding errors but I can't figure out where this one is coming from? Is anyone able to help? Thanks
13 replies
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 12/9/2022 in #djs-questions
Has this button in the user right click a new discord feature or created by discordjs, how if so?
2 replies
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 11/18/2022 in #djs-questions
Discordjs error when executing index.js
Hi! I'm trying to execute my nodejs file but it throws this error when I try to, I was wondering if anyone knew what could be causing it? Thanks Specs: CentOS 7 djs v14.6.0 nodejs 6.14.17 Full error:
[root@vps-c79e2475 discord]# node index.js
/workspace/discord/node_modules/@discordjs/util/dist/index.js:34
return () => defaultValue ??= cb();
^^^

SyntaxError: Unexpected token '??='
at wrapSafe (internal/modules/cjs/loader.js:1001:16)
at Module._compile (internal/modules/cjs/loader.js:1049:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:101:18)
at Object.<anonymous> (/workspace/discord/node_modules/@discordjs/rest/dist/index.js:276:19)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
[root@vps-c79e2475 discord]# node index.js
/workspace/discord/node_modules/@discordjs/util/dist/index.js:34
return () => defaultValue ??= cb();
^^^

SyntaxError: Unexpected token '??='
at wrapSafe (internal/modules/cjs/loader.js:1001:16)
at Module._compile (internal/modules/cjs/loader.js:1049:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:101:18)
at Object.<anonymous> (/workspace/discord/node_modules/@discordjs/rest/dist/index.js:276:19)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
39 replies