Compare commits

...

5 Commits

Author SHA1 Message Date
RADEMAKER Robin
024b34f242 flip it 2022-04-03 22:44:48 +02:00
e201098
cf429b3e4f config 2022-03-31 16:55:17 +02:00
e201098
563369e5ca config 2022-03-31 16:52:58 +02:00
e201098
c48cd4d776 config 2022-03-31 16:52:35 +02:00
e201098
5691d599c0 config 2022-03-31 16:03:16 +02:00

122
index.js
View File

@@ -11,18 +11,44 @@ const Client = new Discord.Client({
Discord.Intents.FLAGS.GUILD_MEMBERS
]
});
const strings = ["Le sportif intelligent évite l'effort inutile",
"On peut savoir sans être intelligent, mais on ne peut être intelligent sans savoir.",
"C'est lorsque l'on commence à se dire intelligent que l'on devient idiot.",
"Quand une phrase ténébreuse, alambiquée vous donne le vertige, souvenez vous que ce qui donne le vertige, c'est le vide",
"J'ai les patates au fond du sac",
"Autrui joue toujours dans la vie de l'individu le rôle d'un modèle, d'un objet, d'un associé ou d'un adversaire",
"Le premier homme à jeter une insulte plutôt quune pierre est le fondateur de la civilisation.",
"Après trente ans passés à étudier la psychologie féminine, je n'ai toujours pas trouvé de réponse à la grande question : Que veulent-elles au juste ?",
"La vie est un mystère qu'il faut vivre, et non un problème à résoudre.",
"Le courage n'est pas l'absence de peur, mais la capacité de vaincre ce qui fait peur.",
"Je vais mettre la viande dans le torchon.",
"Comme mes couilles, toujours dans mes pattes.",
"On n'est pas là pour enculer les mouches",
"L'amour c'est regarder ensemble dans la même direction, comme la levrette",
"Mouette qui pète, gare à la tempête",
"Petit pêt du matin, neige sur les sapins",
"À vaincre sans baril, on triomphe sans boire",
"Noël au balcon, enrhumé comme un con",
"L'amour c'est regarder ensemble dans la même direction, comme la levrette",
"Midi moins le quart ! Mais c'est l'heure du Ricard !",
"L'homme est un animal politique",
"La mort n'est rien pour nous",
"L'ego est une fiction",
"Nattends pas que les événements arrivent comme tu le souhaites ; décide de vouloir ce qui arrive et tu seras heureux",
"L'homme ne devient homme que parmi les hommes.", "Jean c'est trop, t'abuses avec tes 300 phrases là"
]
/*
const data = new SlashCommandBuilder()
.setName("react")
.setDescription("Créer un ajout de rôle")
.setName("flip")
.setDescription("Fait un jet de piece")
.addStringOption(option =>
option.setName('role')
.setDescription('Le rôle à ajouter')
option.setName('side')
.setDescription("Pile ou Face ?")
.setRequired(true)
.addChoice('Lol', 'League_of_Legends')
.addChoice('OW', 'OverWatch')
.addChoice('SW', 'Summoners_War')
)
.addChoice("Pile", 'pile')
.addChoice("Face", 'face'));
*/
let embedCommands = new Discord.MessageEmbed().setTitle("Liste des commandes").setColor("#ff0505")
.setDescription("Voici mes commandes - (N'oublier pas le '!' )")
@@ -33,6 +59,7 @@ let embedCommands = new Discord.MessageEmbed().setTitle("Liste des commandes").s
Client.on("ready", async () => {
fromCommandsToEmbed(friendsCommands.commands)
console.log(`Logged in as ${Client.user.tag}!`)
// pour tout les serveurs - lent : Client.application.commands.create(data)
/*await Client.guilds.cache.get("903598468306702336").commands.create(data)
.then(() => {
@@ -54,12 +81,17 @@ Client.login(config.token)
"token": "ODkwOTc1MDU2NDAwOTA0MjQy.YU3nLg.T5wCbJ4UuDBanMjVaE-JX-aSELo",
"authorId": "307975903999164416"
}
* { bot
"clientId": "905433349080875038",
"guildId": "876543210987654321",
"token": "OTA1NDMzMzQ5MDgwODc1MDM4.YYKAhA.lX9_YqbkTxlkSfnYPOKa2pl5V8s",
"authorId": "307975903999164416"
}
* */
// dev token OTA1NDMzMzQ5MDgwODc1MDM4.YYKAhA.lX9_YqbkTxlkSfnYPOKa2pl5V8s && "clientId": "905433349080875038",
Client.on("interactionCreate", async interaction => {
if (interaction.isCommand()) {
const {commandName} = interaction
if (commandName === "games") {
let embed = new Discord.MessageEmbed()
.setTitle("Mini-Jeux")
@@ -70,36 +102,27 @@ Client.on("interactionCreate", async interaction => {
.addField("__WORlDLE__", "https://worldle.teuteuf.fr/")
.addField("__LETTERS__", "https://edjefferson.com/letterle/ ")
.setTimestamp()
await interaction.channel.send({embeds: [embed]})
interaction.reply({content: 'Done ! :white_check_mark:', ephemeral: true,})
await interaction.reply({embeds: [embed], ephemeral: true})
} else if (commandName === "help") {
await interaction.channel.send({embeds: [embedCommands]})
interaction.reply({content: 'Done ! :white_check_mark:', ephemeral: true,})
await interaction.reply({embeds: [embedCommands], ephemeral: true})
} else if (commandName === 'react') {
const message = await interaction.reply({content: 'Ajout du role : ' + interaction.options._hoistedOptions[0].value, fetchReply: true});
console.log( interaction.options)
} else if (commandName === 'role') {
let roleId = interaction.options._hoistedOptions[0].value
await interaction.member.roles.add(interaction.guild.roles.cache.find(r => r.id === roleId))
await interaction.reply({
content: `Ajout du role : <@&${roleId}>`,
fetchReply: true, ephemeral: true
})
message.react('👍')
.then(() => message.react('👎'))
.catch(error => console.error('One of the emojis failed to react:', error))
} else if (commandName === 'flip') {
let choice = interaction.options._hoistedOptions[0].value
let values = ['face', 'pile'];
let bool = values[(Math.floor(Math.random() * 2))];
let result;
(bool === choice) ? result = bool + " ! Tu as juste eu de la chatte !" : result = bool + " ! Wallah c'est chaud comme tu pues ta grosse mère !";
await interaction.reply(result)
const filter = (reaction, user) => {
return ['👍', '👎'].includes(reaction.emoji.name) && user.id === interaction.user.id;
};
message.awaitReactions({filter, max: 1, time: 60000, errors: ['time']})
.then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === '👍') {
message.reply('Ajout effectué !');
} else {
message.reply('Suppression effectuée !');
}
})
.catch(collected => {
message.reply('You reacted with neither a thumbs up, nor a thumbs down.');
});
}
}
})
@@ -117,28 +140,15 @@ Client.on('messageCreate', message => {
Client.login(config.token)
console.log("Successfully reloaded")
} else if (message.content.indexOf("!") === 0) {
let commands = friendsCommands.commands
commands.forEach(command => {
if (message.content.substring(1, message.content.length) === command.key)
send(message, command.value)
})
}
})
Client.on('messageReactionAdd', async (reaction, user) => {
// When a reaction is received, check if the structure is partial
if (reaction.partial) {
// If the message this reaction belongs to was removed, the fetching might result in an API error which should be handled
try {
await reaction.fetch();
if (reaction.emoji.name === '👍') {
reaction.reply("J'ajoute ton rôle")
}
} catch
(error) {
console.error('Something went wrong when fetching the message:', error);
// Return as `reaction.message.author` may be undefined/null
if (message.content.substring(1, 5) === "jean") {
let arg = strings[Math.floor(Math.random() * strings.length)]
send(message, arg);
} else {
let commands = friendsCommands.commands
commands.forEach(command => {
if (message.content.substring(1, message.content.length) === command.key)
send(message, command.value)
})
}
}
})