Compare commits
8 Commits
e18c9aa28d
...
master
Author | SHA1 | Date | |
---|---|---|---|
9a9f7d3cc5 | |||
a5ed48a315 | |||
86e61fa589 | |||
aa96432be1 | |||
5106d3c637 | |||
c2fdd44901 | |||
831f8be7c9 | |||
284e6e12a1 |
@ -20,7 +20,7 @@ const responses = [
|
|||||||
"Vous pouvez répéter la question ?",
|
"Vous pouvez répéter la question ?",
|
||||||
"Bon sang, mais c'est bien sûr !",
|
"Bon sang, mais c'est bien sûr !",
|
||||||
"Mais vous êtes fous !",
|
"Mais vous êtes fous !",
|
||||||
"Mais evidemment !",
|
"Mais évidemment !",
|
||||||
"Bizarrement, oui.",
|
"Bizarrement, oui.",
|
||||||
"Essaye plus tard",
|
"Essaye plus tard",
|
||||||
"Essaye encore",
|
"Essaye encore",
|
||||||
@ -51,8 +51,7 @@ module.exports = {
|
|||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
const question = interaction.options.get('question').value;
|
const question = interaction.options.get('question').value;
|
||||||
const i = Math.floor(Math.random() * responses.length);
|
const i = Math.floor(Math.random() * responses.length);
|
||||||
const reply = "*" + interaction.user.username + " a demandé : " + question + "*\n" + quote( responses[i] ) ;
|
const reply = "*" + interaction.member.displayName + " a demandé : " + question + "*\n" + quote( responses[i] ) ;
|
||||||
//const reply = responses[i] + "\n >>> " + question;
|
|
||||||
await interaction.reply(reply)
|
await interaction.reply(reply)
|
||||||
.then(console.log("Reply sent to 8ball command."))
|
.then(console.log("Reply sent to 8ball command."))
|
||||||
.catch(console.error);
|
.catch(console.error);
|
||||||
|
@ -5,6 +5,6 @@ module.exports = {
|
|||||||
.setName('server')
|
.setName('server')
|
||||||
.setDescription('Replies with Server info!'),
|
.setDescription('Replies with Server info!'),
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
await interaction.reply(`Server name: ${interaction.guild.name}\nTotal members: ${interaction.guild.memberCount}`);
|
await interaction.reply({content:`Server name: ${interaction.guild.name}\nTotal members: ${interaction.guild.memberCount}` , ephemeral:true});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -5,6 +5,6 @@ module.exports = {
|
|||||||
.setName('user')
|
.setName('user')
|
||||||
.setDescription('Replies with User info!'),
|
.setDescription('Replies with User info!'),
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
await interaction.reply(`Your tag: ${interaction.user.tag}\nYour id: ${interaction.user.id}`);
|
await interaction.reply({content: 'Your tag: ${interaction.user.tag}\nYour id: ${interaction.user.id}', ephemeral:true});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -6,7 +6,7 @@ var wwId = 1;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This function aims to do word wars inside a discord channel.
|
* This function aims to do word wars inside a discord channel.
|
||||||
* Someone launches a wordwar and other people can join in by clicking on the react icon.
|
* Someone launches a wrdwar and other people can join in by clicking on the react icon.
|
||||||
* First argument is the time of duration of the wordwar.
|
* First argument is the time of duration of the wordwar.
|
||||||
* Second argument is the waiting time before the wordwar.
|
* Second argument is the waiting time before the wordwar.
|
||||||
**/
|
**/
|
||||||
@ -85,7 +85,7 @@ module.exports = {
|
|||||||
ongoingww.set(interaction.user.id, wwRole.name);
|
ongoingww.set(interaction.user.id, wwRole.name);
|
||||||
interaction.member.roles.add(wwRole.id);
|
interaction.member.roles.add(wwRole.id);
|
||||||
|
|
||||||
commandReply = "Une wordwar a été initiée. Elle commencera dans " + wwdelay + " minutes et durera " + wwtimer + " minutes.";
|
const commandReply = getRegistered(wwRole.name,wwdelay,wwtimer);
|
||||||
|
|
||||||
const row = new MessageActionRow()
|
const row = new MessageActionRow()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
@ -114,13 +114,14 @@ module.exports = {
|
|||||||
|
|
||||||
collectorParticipate.on('collect', async i => {
|
collectorParticipate.on('collect', async i => {
|
||||||
if (i.member.roles.cache.has(wwRole.id)) {
|
if (i.member.roles.cache.has(wwRole.id)) {
|
||||||
OnlyReply('Vous êtes déjà enregistré pour cette wordwar', i, wwRole);
|
OnlyReply('Vous êtes déjà enregistré.e pour cette wordwar', i, wwRole);
|
||||||
} else if (ongoingww.has(i.user.id)) {
|
} else if (ongoingww.has(i.user.id)) {
|
||||||
OnlyReply('Vous êtes déjà enregistré dans la wordwar ' + ongoingww.get(i.user.id), i, wwRole);
|
OnlyReply('Vous êtes déjà enregistré.e dans la wordwar ' + ongoingww.get(i.user.id), i, wwRole);
|
||||||
} else {
|
} else {
|
||||||
i.member.roles.add(wwRole);
|
i.member.roles.add(wwRole);
|
||||||
ongoingww.set(i.user.ida, wwRole);
|
ongoingww.set(i.user.id, wwRole.name);
|
||||||
OnlyReply('Participation est enregistrée', i, wwRole);
|
i.message.edit(getRegistered(wwRole.name, wwdelay, wwtimer));
|
||||||
|
i.deferUpdate();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -134,9 +135,10 @@ module.exports = {
|
|||||||
if (!i.member.roles.cache.has(wwRole.id)) {
|
if (!i.member.roles.cache.has(wwRole.id)) {
|
||||||
OnlyReply('Vous n\'êtes pas enregistré pour cette wordwar', i, wwRole);
|
OnlyReply('Vous n\'êtes pas enregistré pour cette wordwar', i, wwRole);
|
||||||
} else {
|
} else {
|
||||||
OnlyReply('Participation est annulée', i, wwRole);
|
|
||||||
i.member.roles.remove(wwRole);
|
i.member.roles.remove(wwRole);
|
||||||
ongoingww.delete(i.user.id);
|
ongoingww.delete(i.user.id);
|
||||||
|
console.log(ongoingww);
|
||||||
|
i.deferUpdate();
|
||||||
|
|
||||||
// Si l'utilisateur qui annule est le dernier dans cette wordwar
|
// Si l'utilisateur qui annule est le dernier dans cette wordwar
|
||||||
if (typeof ongoingww.find(wordWar => wordWar == wwRole.name) == "undefined") {
|
if (typeof ongoingww.find(wordWar => wordWar == wwRole.name) == "undefined") {
|
||||||
@ -152,6 +154,8 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
console.log(wwRole.name + ' canceled');
|
console.log(wwRole.name + ' canceled');
|
||||||
return;
|
return;
|
||||||
|
}else{
|
||||||
|
i.message.edit(getRegistered(wwRole.name, wwdelay, wwtimer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -159,12 +163,12 @@ module.exports = {
|
|||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
if (wwRole.deleted != true) {
|
if (wwRole.deleted != true) {
|
||||||
console.log(wwRole.name + ' launched');
|
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 participantStart = '\nLa ' + wwRole.name + ' commence. Vous pouvez toujours la rejoindre si vous le désirez. Bonne chance à tou.te.s !! ' + roleMention(wwRole.id) + '\n';
|
||||||
publicReplies = await interaction.channel.send({ content: participantStart, fetchReply: true });
|
publicReplies = await interaction.channel.send({ content: participantStart, fetchReply: true });
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
if (wwRole.deleted != true) {
|
if (wwRole.deleted != true) {
|
||||||
console.log(wwRole.name + ' 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';
|
var participantEnd = 'La ' + wwRole.name + ' est maintenant terminée, merci d\'y avoir participé \! ' + roleMention(wwRole.id) + '\n';
|
||||||
await interaction.channel.send({ content: participantEnd, fetchReply: true });
|
await interaction.channel.send({ content: participantEnd, fetchReply: true });
|
||||||
ongoingww.forEach((value,key,ongoingww) => {
|
ongoingww.forEach((value,key,ongoingww) => {
|
||||||
if (value == wwRole.name) {
|
if (value == wwRole.name) {
|
||||||
@ -199,3 +203,13 @@ function OnlyReply(str, int, ww) {
|
|||||||
int.deferUpdate();
|
int.deferUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getRegistered(ww,d, t) {
|
||||||
|
var str = "";
|
||||||
|
ongoingww.forEach(async (value, key) => {
|
||||||
|
if (value == ww){
|
||||||
|
str += userMention(key) + ' ';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return "la " + ww + " a été initiée. Elle commencera dans " + d + " minutes et durera " + t + " minutes.\nInscrits : " + str;
|
||||||
|
}
|
Reference in New Issue
Block a user