brokenrecord388
brokenrecord388
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 10/6/2024 in #djs-questions
Unknown interaction
oh okay, thanks 🙂
25 replies
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 10/6/2024 in #djs-questions
Unknown interaction
my understanding of await was just that it held the thread until it was done, what would that do to impove that bit since thats just updating internal variables?
25 replies
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 10/6/2024 in #djs-questions
Unknown interaction
I did but it still did it, possibly me being a bonehead in that department and restarting the bot too quickly, I've left it commented out for now, the only reason it's there is cause my lazy ass keeps forgetting to defer my dropdowns
25 replies
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 10/6/2024 in #djs-questions
Unknown interaction
also I've just found the issue by accident, it's this part:
if (interaction.replied || interaction.deferred) return;
await interaction.deferUpdate().catch(err => cache.handleError(err, true));
if (interaction.replied || interaction.deferred) return;
await interaction.deferUpdate().catch(err => cache.handleError(err, true));
didn't notice it on the look through, that bit was put there on the assumption I was always going to be deferUpdate'ing, removing this bit fixes it
25 replies
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 10/6/2024 in #djs-questions
Unknown interaction
🤦
25 replies
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 10/6/2024 in #djs-questions
Unknown interaction
you were right, I didn't notice the true that silences the error, the deferUpdate is erroring too 🙂
25 replies
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 10/6/2024 in #djs-questions
Unknown interaction
{
var stinky = "poopyhead";
let stonky = "thingy";
}

console.log(stinky); //print "poopyhead"
console.log(stonky); //stonky missing
{
var stinky = "poopyhead";
let stonky = "thingy";
}

console.log(stinky); //print "poopyhead"
console.log(stonky); //stonky missing
etc?
25 replies
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 10/6/2024 in #djs-questions
Unknown interaction
so
25 replies
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 10/6/2024 in #djs-questions
Unknown interaction
25 replies
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 10/6/2024 in #djs-questions
Unknown interaction
is there an ezpz dumb dumb explanation or is it just an avoid
25 replies
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 10/6/2024 in #djs-questions
Unknown interaction
ok
25 replies
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 10/6/2024 in #djs-questions
Unknown interaction
hm
25 replies
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 10/6/2024 in #djs-questions
Unknown interaction
honestly I don't know the difference between let and var etc, don't tell the developers
25 replies
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 10/6/2024 in #djs-questions
Unknown interaction
that handler just adds some ✨ pazazz ✨
25 replies
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 10/6/2024 in #djs-questions
Unknown interaction
that catch prints the error when it detects one, I took it off showModal just so it wouldn't go through my error handler
25 replies
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 10/6/2024 in #djs-questions
Unknown interaction
export default class SelectMenu implements DiscordEvent {
public name = Events.InteractionCreate
async execute(cache: Cache, data: any[]) {
const interaction: Interaction = data[0];
if (!interaction) return;
if (!interaction.isAnySelectMenu()) return;

var dropdown = cache.storage.dropdowns[interaction.customId];
if (!dropdown) {
for (const drop in cache.storage.dropdowns) {
if (!drop.includes("*")) continue;
const regex = new RegExp("^" + drop.split("*").map((str: string) => str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1")).join(".*") + "$");
if (regex.test(interaction.customId)) {
const subdrop = cache.storage.registerDropdown(interaction.customId);
dropdown = subdrop;
break;
}
}
}
if (dropdown) {
if (dropdown.authorOnly && interaction.user.id !== dropdown.author) {
interaction.reply({ embeds: [
Messages.Error(cache, "This is not your dropdown to use!")
], ephemeral: true })
return;
}

dropdown.setValue(interaction.user.id, interaction.values);
if (dropdown.execute) {
dropdown.execute(cache, interaction);
}
}

if (interaction.replied || interaction.deferred) return;
await interaction.deferUpdate().catch(err => cache.handleError(err, true));
}
};
export default class SelectMenu implements DiscordEvent {
public name = Events.InteractionCreate
async execute(cache: Cache, data: any[]) {
const interaction: Interaction = data[0];
if (!interaction) return;
if (!interaction.isAnySelectMenu()) return;

var dropdown = cache.storage.dropdowns[interaction.customId];
if (!dropdown) {
for (const drop in cache.storage.dropdowns) {
if (!drop.includes("*")) continue;
const regex = new RegExp("^" + drop.split("*").map((str: string) => str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1")).join(".*") + "$");
if (regex.test(interaction.customId)) {
const subdrop = cache.storage.registerDropdown(interaction.customId);
dropdown = subdrop;
break;
}
}
}
if (dropdown) {
if (dropdown.authorOnly && interaction.user.id !== dropdown.author) {
interaction.reply({ embeds: [
Messages.Error(cache, "This is not your dropdown to use!")
], ephemeral: true })
return;
}

dropdown.setValue(interaction.user.id, interaction.values);
if (dropdown.execute) {
dropdown.execute(cache, interaction);
}
}

if (interaction.replied || interaction.deferred) return;
await interaction.deferUpdate().catch(err => cache.handleError(err, true));
}
};
(this is just a wrapper-ish thing that is auto-registered to client.on etc)
25 replies
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 10/6/2024 in #djs-questions
Unknown interaction
I mean that's what I thought, let me get you the event, all the register method is doing is listing the customid on an object array for the event listener
25 replies
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 10/6/2024 in #djs-questions
Unknown interaction
let me just try moving getLengthModal into a static variable
25 replies
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 10/6/2024 in #djs-questions
Unknown interaction
this.data is an object, example:
public data: {
length: number,
type: EventType,
date: Date,
note: string | undefined,
ownerTextOverride: string | undefined;
typeTextOverride: string | undefined;
colorOverride: HexColorString | undefined;
};
public data: {
length: number,
type: EventType,
date: Date,
note: string | undefined,
ownerTextOverride: string | undefined;
typeTextOverride: string | undefined;
colorOverride: HexColorString | undefined;
};
in this case, length is any number
25 replies
DIAdiscord.js - Imagine an app
Created by brokenrecord388 on 10/6/2024 in #djs-questions
Unknown interaction
No description
25 replies