InkLHT_
InkLHT_
DIAdiscord.js - Imagine an app
Created by InkLHT_ on 12/10/2023 in #djs-questions
scheduledEvents
No description
19 replies
DIAdiscord.js - Imagine an app
Created by InkLHT_ on 8/10/2023 in #djs-questions
UNHANDLED_REJECTION: DiscordAPIError: Unknown Message
Hello, I have some issues about my bot. To explain where the errors come from is when I delete RulesMessage even if it deletes correctly and send the other embed (sorry for mistakes in my grammar) Here the part of the code :
const filter_one = (interaction) => interaction.customId === 'b-welcome' && interaction.user.id === member.user.id ;
const collector_one = welcomeChannel.threads.cache.find(x => x.name === thread_title).createMessageComponentCollector({ filter_one, time: 999999999 });


collector_one.on('collect', async (interaction) => {
await interaction.deferUpdate();
await welcomeMessage.delete();

const rules_embed = new MessageEmbed()
.setColor("BLACK")
.setDescription(skedDB.step_one.rules_server.titre + "\n" + skedDB.step_one.rules_server.citations_txt )
.setImage(skedDB.step_one.rules_server.attachment)

const rules_Button = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('first-step')
.setLabel("Suivant")
.setStyle('PRIMARY'),
);

const RulesMessage = await welcomeChannel.threads.cache.find(x => x.name === thread_title).send({ embeds: [rules_embed], components: [rules_Button] });

// ------------------2EME ETAPE DU GUIDE --------------------

const filter_two = (interaction) => interaction.customId === 'first-step' && interaction.user.id === member.user.id ;
const collector_two = welcomeChannel.threads.cache.find(x => x.name === thread_title).createMessageComponentCollector({ filter_two, time: 999999999 });

collector_two.on('collect', async (interaction) => {
// await interaction.deferUpdate();
//await RulesMessage.delete();

const channels_embed = new MessageEmbed()
.setColor("BLACK")
.setDescription(skedDB.step_two.rules_server.titre + "\n" + skedDB.step_two.rules_server.citations_txt )
.setImage(skedDB.step_two.rules_server.attachment)

const Channels_Button = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('snd-help')
.setLabel("Aide moi!")
.setStyle('DANGER'),

new MessageButton()
.setCustomId('snd-step')
.setLabel("On passe")
.setStyle('SUCCESS'),
);
//const ChannelMessage =
await welcomeChannel.threads.cache.find(x => x.name === thread_title).send({ embeds: [channels_embed], components: [Channels_Button] }).then(async (RulesDelete) => {
try {
await RulesMessage.delete();
} catch (error) {
console.log('Erreur sur la suppression de RulesMessage:', error);
}
});

});

});
const filter_one = (interaction) => interaction.customId === 'b-welcome' && interaction.user.id === member.user.id ;
const collector_one = welcomeChannel.threads.cache.find(x => x.name === thread_title).createMessageComponentCollector({ filter_one, time: 999999999 });


collector_one.on('collect', async (interaction) => {
await interaction.deferUpdate();
await welcomeMessage.delete();

const rules_embed = new MessageEmbed()
.setColor("BLACK")
.setDescription(skedDB.step_one.rules_server.titre + "\n" + skedDB.step_one.rules_server.citations_txt )
.setImage(skedDB.step_one.rules_server.attachment)

const rules_Button = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('first-step')
.setLabel("Suivant")
.setStyle('PRIMARY'),
);

const RulesMessage = await welcomeChannel.threads.cache.find(x => x.name === thread_title).send({ embeds: [rules_embed], components: [rules_Button] });

// ------------------2EME ETAPE DU GUIDE --------------------

const filter_two = (interaction) => interaction.customId === 'first-step' && interaction.user.id === member.user.id ;
const collector_two = welcomeChannel.threads.cache.find(x => x.name === thread_title).createMessageComponentCollector({ filter_two, time: 999999999 });

collector_two.on('collect', async (interaction) => {
// await interaction.deferUpdate();
//await RulesMessage.delete();

const channels_embed = new MessageEmbed()
.setColor("BLACK")
.setDescription(skedDB.step_two.rules_server.titre + "\n" + skedDB.step_two.rules_server.citations_txt )
.setImage(skedDB.step_two.rules_server.attachment)

const Channels_Button = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('snd-help')
.setLabel("Aide moi!")
.setStyle('DANGER'),

new MessageButton()
.setCustomId('snd-step')
.setLabel("On passe")
.setStyle('SUCCESS'),
);
//const ChannelMessage =
await welcomeChannel.threads.cache.find(x => x.name === thread_title).send({ embeds: [channels_embed], components: [Channels_Button] }).then(async (RulesDelete) => {
try {
await RulesMessage.delete();
} catch (error) {
console.log('Erreur sur la suppression de RulesMessage:', error);
}
});

});

});
15 replies