RobbyV
RobbyV
DIAdiscord.js - Imagine an app
Created by RobbyV on 8/13/2023 in #djs-questions
member.dmChannel.awaitMessages() breaking when updating from v14.11 to v14.12
Oh, I didn’t know I could do that, thanks so much for the tip!
23 replies
DIAdiscord.js - Imagine an app
Created by RobbyV on 8/13/2023 in #djs-questions
member.dmChannel.awaitMessages() breaking when updating from v14.11 to v14.12
Awesome, thanks.
23 replies
DIAdiscord.js - Imagine an app
Created by RobbyV on 8/13/2023 in #djs-questions
member.dmChannel.awaitMessages() breaking when updating from v14.11 to v14.12
Sorry I didn't see your original message but yeah that should do the same thing
23 replies
DIAdiscord.js - Imagine an app
Created by RobbyV on 8/13/2023 in #djs-questions
member.dmChannel.awaitMessages() breaking when updating from v14.11 to v14.12
I have a feeling this is a bug in 14.12.0 and above just because of the fact that it immediately fixes itself when I downgrade to 14.11.0.
23 replies
DIAdiscord.js - Imagine an app
Created by RobbyV on 8/13/2023 in #djs-questions
member.dmChannel.awaitMessages() breaking when updating from v14.11 to v14.12
Yeah I don't have a choice unfortunately which adds extra complications to everything
23 replies
DIAdiscord.js - Imagine an app
Created by RobbyV on 8/13/2023 in #djs-questions
member.dmChannel.awaitMessages() breaking when updating from v14.11 to v14.12
if (!embedData) return Error('Failed to provide embed data.');
if (this.previousMessage) await this.previousMessage.delete();
let filter = m => m.author.id == this.interaction.user.id;
let promptEmbed = new Discord.EmbedBuilder(embedData).setFooter({ text: cancelPromptMessage }).setTimestamp(Date.now());
if ((promptEmbed.title == '') || !promptEmbed) promptEmbed.setTitle(this.title);
if (skipable) promptEmbed.setFooter({ text: skipPromptMessage });
let memberId = this.interaction.user.id
let newPrompt = (await this.interaction.client.shard.broadcastEval(async (client, { promptEmbed, memberId }) => {
let member = await client.users.fetch(memberId)
if (member && client.shard.ids == 0) {
let message = await member.send({ embeds: [promptEmbed] })
return [message, message.url]
}
}, { context: { promptEmbed, memberId } }).catch(async () => {
return [false]
}))[0]
if (newPrompt == false) {
this.endPrompt('errorWithReason', "We couldn't send you a DM as they are closed.");
return
}
let ActionRow = new Discord.ActionRowBuilder()
const movedToDMButton = ActionRow.addComponents(new Discord.ButtonBuilder().setURL(newPrompt[1]).setLabel('Jump to DM').setStyle(Discord.ButtonStyle.Link));
if (this.interaction.deferred || this.interaction.replied) {
await this.interaction.editReply({ embeds: [movedToDM], components: [movedToDMButton] })
} else {
await this.interaction.reply({ embeds: [movedToDM], components: [movedToDMButton] })
}
this.redirectedToDMs = true
try {
let message = (await this.interaction.client.shard.broadcastEval(async (client, { memberId, filter, timeOutTime }) => {
let member = await client.users.fetch(memberId)
if (client.shard.ids[0] == 0) {
let message = await member.dmChannel.awaitMessages({ filter, max: 1, time: timeOutTime, errors: ['time'] });
if (message.first() && message.first().attachments.first()) return [message.first(), message.first().attachments.first()]
else if (message.first() && !message.first().attachments.first()) return [message.first()]
}
}, { context: { memberId, filter, timeOutTime } }))[0]
if (message[0].content == 'cancel') {
this.endPrompt('cancel')
return
}
if (message[0].content == 'skip' && skipable) return false;
if (message[1]) {
let newData = message[0]
newData.attachments = message[1]
return newData;
}
return message[0];
} catch {
this.endPrompt('time');
return false
}
if (!embedData) return Error('Failed to provide embed data.');
if (this.previousMessage) await this.previousMessage.delete();
let filter = m => m.author.id == this.interaction.user.id;
let promptEmbed = new Discord.EmbedBuilder(embedData).setFooter({ text: cancelPromptMessage }).setTimestamp(Date.now());
if ((promptEmbed.title == '') || !promptEmbed) promptEmbed.setTitle(this.title);
if (skipable) promptEmbed.setFooter({ text: skipPromptMessage });
let memberId = this.interaction.user.id
let newPrompt = (await this.interaction.client.shard.broadcastEval(async (client, { promptEmbed, memberId }) => {
let member = await client.users.fetch(memberId)
if (member && client.shard.ids == 0) {
let message = await member.send({ embeds: [promptEmbed] })
return [message, message.url]
}
}, { context: { promptEmbed, memberId } }).catch(async () => {
return [false]
}))[0]
if (newPrompt == false) {
this.endPrompt('errorWithReason', "We couldn't send you a DM as they are closed.");
return
}
let ActionRow = new Discord.ActionRowBuilder()
const movedToDMButton = ActionRow.addComponents(new Discord.ButtonBuilder().setURL(newPrompt[1]).setLabel('Jump to DM').setStyle(Discord.ButtonStyle.Link));
if (this.interaction.deferred || this.interaction.replied) {
await this.interaction.editReply({ embeds: [movedToDM], components: [movedToDMButton] })
} else {
await this.interaction.reply({ embeds: [movedToDM], components: [movedToDMButton] })
}
this.redirectedToDMs = true
try {
let message = (await this.interaction.client.shard.broadcastEval(async (client, { memberId, filter, timeOutTime }) => {
let member = await client.users.fetch(memberId)
if (client.shard.ids[0] == 0) {
let message = await member.dmChannel.awaitMessages({ filter, max: 1, time: timeOutTime, errors: ['time'] });
if (message.first() && message.first().attachments.first()) return [message.first(), message.first().attachments.first()]
else if (message.first() && !message.first().attachments.first()) return [message.first()]
}
}, { context: { memberId, filter, timeOutTime } }))[0]
if (message[0].content == 'cancel') {
this.endPrompt('cancel')
return
}
if (message[0].content == 'skip' && skipable) return false;
if (message[1]) {
let newData = message[0]
newData.attachments = message[1]
return newData;
}
return message[0];
} catch {
this.endPrompt('time');
return false
}
23 replies
DIAdiscord.js - Imagine an app
Created by RobbyV on 8/13/2023 in #djs-questions
member.dmChannel.awaitMessages() breaking when updating from v14.11 to v14.12
It's a little bit of a mess but sure
23 replies
DIAdiscord.js - Imagine an app
Created by RobbyV on 8/13/2023 in #djs-questions
member.dmChannel.awaitMessages() breaking when updating from v14.11 to v14.12
But there is definitely a DM open with the user before it tries to await a message
23 replies
DIAdiscord.js - Imagine an app
Created by RobbyV on 8/13/2023 in #djs-questions
member.dmChannel.awaitMessages() breaking when updating from v14.11 to v14.12
Yeah, it's quite a bit higher in the function though
23 replies
DIAdiscord.js - Imagine an app
Created by RobbyV on 8/13/2023 in #djs-questions
member.dmChannel.awaitMessages() breaking when updating from v14.11 to v14.12
I do that
let message = await member.send({ embeds: [promptEmbed] })
let message = await member.send({ embeds: [promptEmbed] })
23 replies
DIAdiscord.js - Imagine an app
Created by RobbyV on 8/13/2023 in #djs-questions
member.dmChannel.awaitMessages() breaking when updating from v14.11 to v14.12
Also the bot does DM the user before awaiting the message
23 replies
DIAdiscord.js - Imagine an app
Created by RobbyV on 8/13/2023 in #djs-questions
member.dmChannel.awaitMessages() breaking when updating from v14.11 to v14.12
As well as every version of 14 prior to the current one
23 replies
DIAdiscord.js - Imagine an app
Created by RobbyV on 8/13/2023 in #djs-questions
member.dmChannel.awaitMessages() breaking when updating from v14.11 to v14.12
Why did it work in 14.11 though?
23 replies
DIAdiscord.js - Imagine an app
Created by RobbyV on 5/30/2023 in #djs-questions
Unknown interaction for some commands in only one server
Issue fixed, I did indeed have another interactionCreate listener hidden in my code which was taking to long to return the data.
11 replies
DIAdiscord.js - Imagine an app
Created by RobbyV on 5/30/2023 in #djs-questions
Unknown interaction for some commands in only one server
No, just that one
11 replies
DIAdiscord.js - Imagine an app
Created by RobbyV on 5/30/2023 in #djs-questions
Unknown interaction for some commands in only one server
client.on("interactionCreate", async (interaction) => {
if (interaction.type != Discord.InteractionType.ApplicationCommand) return;

const command = client.commands.get(interaction.commandName);

if (!command) return;

try {
await command.execute(interaction);
} catch (error) {
console.error(error);
let minifiedError = error.toString().split('\n', 1)[0];
return services.Utility.errorEmbed(interaction, 'A fatal error occured.')
}
})
client.on("interactionCreate", async (interaction) => {
if (interaction.type != Discord.InteractionType.ApplicationCommand) return;

const command = client.commands.get(interaction.commandName);

if (!command) return;

try {
await command.execute(interaction);
} catch (error) {
console.error(error);
let minifiedError = error.toString().split('\n', 1)[0];
return services.Utility.errorEmbed(interaction, 'A fatal error occured.')
}
})
11 replies
DIAdiscord.js - Imagine an app
Created by RobbyV on 5/30/2023 in #djs-questions
Unknown interaction for some commands in only one server
Sure
11 replies
DIAdiscord.js - Imagine an app
Created by RobbyV on 5/30/2023 in #djs-questions
Unknown interaction for some commands in only one server
Like I mentioned, the response is being deferred right on the first line and it still happens, it also can't be the wrong interaction object because it works completely fine in other servers.
11 replies
DIAdiscord.js - Imagine an app
Created by RobbyV on 6/25/2022 in #djs-questions
Constant holding a collection of invites changing without being changed
Alright, it worked, thanks a lot for your help.
28 replies
DIAdiscord.js - Imagine an app
Created by RobbyV on 6/25/2022 in #djs-questions
Constant holding a collection of invites changing without being changed
I do lol, let me try that.
28 replies