bug fix wordwar
This commit is contained in:
parent
0ab0bcac22
commit
ec95f1a24a
@ -103,6 +103,9 @@ module.exports = {
|
||||
|
||||
interaction.reply({ content: commandReply, components: [row] })
|
||||
.then(() => {
|
||||
|
||||
var publicReplies = undefined;
|
||||
|
||||
const filterParticipate = (btnInt) => btnInt.customId === 'primary';
|
||||
|
||||
const collectorParticipate = interaction.channel.createMessageComponentCollector({
|
||||
@ -128,7 +131,6 @@ module.exports = {
|
||||
});
|
||||
|
||||
collectorCancel.on('collect', async i => {
|
||||
console.log("pouet on passe combien de fois ici ?");
|
||||
if (!i.member.roles.cache.has(wwRole.id)) {
|
||||
OnlyReply('Vous n\'êtes pas enregistré pour cette wordwar', i, wwRole);
|
||||
} else {
|
||||
@ -145,43 +147,39 @@ module.exports = {
|
||||
wwRole.delete();
|
||||
collectorCancel.stop();
|
||||
collectorParticipate.stop();
|
||||
if (publicReplies != undefined) {
|
||||
publicReplies.delete();
|
||||
}
|
||||
console.log(wwRole.name + ' canceled');
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (wwRole.deleted != true) {
|
||||
setTimeout(async () => {
|
||||
console.log('Wordwar launched');
|
||||
if (wwRole.deleted != true) {
|
||||
console.log(wwRole.name + ' launched');
|
||||
var participantStart = '\nLa wordwar ' + wwRole.name + ' commence. Vous pouvez toujours la rejoindre si vous le désirez. Bonne chance à tou.te.s !! ' + roleMention(wwRole.id) + '\n';
|
||||
var sentMsg = await interaction.channel.send({ content: participantStart, fetchReply: true });
|
||||
if (wwRole.deleted != true) {
|
||||
publicReplies = await interaction.channel.send({ content: participantStart, fetchReply: true });
|
||||
setTimeout(async () => {
|
||||
if (wwRole.deleted != true) {
|
||||
console.log('Wordwar ended');
|
||||
console.log(wwRole.name + ' ended');
|
||||
var participantEnd = 'La wordwar ' + wwRole.name + ' est maintenant terminée, merci d\'y avoir participé \! ' + roleMention(wwRole.id) + '\n';
|
||||
interaction.channel.send(participantEnd);
|
||||
ongoingww.forEach(element => {
|
||||
if (element.value == wwRole.name) {
|
||||
element.delete();
|
||||
await interaction.channel.send({ content: participantEnd, fetchReply: true });
|
||||
ongoingww.forEach((value,key,ongoingww) => {
|
||||
if (value == wwRole.name) {
|
||||
ongoingww.delete(key);
|
||||
}
|
||||
collectorCancel.stop();
|
||||
collectorParticipate.stop();
|
||||
});
|
||||
setTimeout(() => {
|
||||
wwRole.delete();
|
||||
collectorCancel.stop();
|
||||
collectorParticipate.stop();
|
||||
}, 30 * 1000); // Wait 30 seconds to delete the role
|
||||
} else {
|
||||
sentMsg.delete();
|
||||
console.log('Wordwar canceled');
|
||||
}
|
||||
}, wwtimer * 1000);
|
||||
} else {
|
||||
sentMsg.delete();
|
||||
console.log('Wordwar canceled');
|
||||
}
|
||||
}, wwdelay * 1000);
|
||||
}
|
||||
});
|
||||
/* }
|
||||
*/ }
|
||||
@ -197,7 +195,7 @@ function OnlyReply(str, int, ww) {
|
||||
intTable.set(ww.name + int.user.id, int);
|
||||
int.reply({ content: str, ephemeral: true });
|
||||
} else {
|
||||
intTable.get(ww.name + int.user.id).editReply({ content: str, ephemeral: true });
|
||||
intTable.get(ww.name + int.user.id).editReply({ content: str, ephemeral: true, fetchReply: true });
|
||||
int.deferUpdate();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user