Compare commits
5 Commits
c2c53edc58
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
024b34f242 | ||
|
|
cf429b3e4f | ||
|
|
563369e5ca | ||
|
|
c48cd4d776 | ||
|
|
5691d599c0 |
122
index.js
122
index.js
@@ -11,18 +11,44 @@ const Client = new Discord.Client({
|
|||||||
Discord.Intents.FLAGS.GUILD_MEMBERS
|
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 qu’une 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",
|
||||||
|
"N’attends 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()
|
const data = new SlashCommandBuilder()
|
||||||
.setName("react")
|
.setName("flip")
|
||||||
.setDescription("Créer un ajout de rôle")
|
.setDescription("Fait un jet de piece")
|
||||||
.addStringOption(option =>
|
.addStringOption(option =>
|
||||||
option.setName('role')
|
option.setName('side')
|
||||||
.setDescription('Le rôle à ajouter')
|
.setDescription("Pile ou Face ?")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
.addChoice('Lol', 'League_of_Legends')
|
.addChoice("Pile", 'pile')
|
||||||
.addChoice('OW', 'OverWatch')
|
.addChoice("Face", 'face'));
|
||||||
.addChoice('SW', 'Summoners_War')
|
|
||||||
)
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
let embedCommands = new Discord.MessageEmbed().setTitle("Liste des commandes").setColor("#ff0505")
|
let embedCommands = new Discord.MessageEmbed().setTitle("Liste des commandes").setColor("#ff0505")
|
||||||
.setDescription("Voici mes commandes - (N'oublier pas le '!' )")
|
.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 () => {
|
Client.on("ready", async () => {
|
||||||
fromCommandsToEmbed(friendsCommands.commands)
|
fromCommandsToEmbed(friendsCommands.commands)
|
||||||
console.log(`Logged in as ${Client.user.tag}!`)
|
console.log(`Logged in as ${Client.user.tag}!`)
|
||||||
|
|
||||||
// pour tout les serveurs - lent : Client.application.commands.create(data)
|
// pour tout les serveurs - lent : Client.application.commands.create(data)
|
||||||
/*await Client.guilds.cache.get("903598468306702336").commands.create(data)
|
/*await Client.guilds.cache.get("903598468306702336").commands.create(data)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@@ -54,12 +81,17 @@ Client.login(config.token)
|
|||||||
"token": "ODkwOTc1MDU2NDAwOTA0MjQy.YU3nLg.T5wCbJ4UuDBanMjVaE-JX-aSELo",
|
"token": "ODkwOTc1MDU2NDAwOTA0MjQy.YU3nLg.T5wCbJ4UuDBanMjVaE-JX-aSELo",
|
||||||
"authorId": "307975903999164416"
|
"authorId": "307975903999164416"
|
||||||
}
|
}
|
||||||
|
* { bot
|
||||||
|
"clientId": "905433349080875038",
|
||||||
|
"guildId": "876543210987654321",
|
||||||
|
"token": "OTA1NDMzMzQ5MDgwODc1MDM4.YYKAhA.lX9_YqbkTxlkSfnYPOKa2pl5V8s",
|
||||||
|
"authorId": "307975903999164416"
|
||||||
|
}
|
||||||
* */
|
* */
|
||||||
// dev token OTA1NDMzMzQ5MDgwODc1MDM4.YYKAhA.lX9_YqbkTxlkSfnYPOKa2pl5V8s && "clientId": "905433349080875038",
|
// dev token OTA1NDMzMzQ5MDgwODc1MDM4.YYKAhA.lX9_YqbkTxlkSfnYPOKa2pl5V8s && "clientId": "905433349080875038",
|
||||||
Client.on("interactionCreate", async interaction => {
|
Client.on("interactionCreate", async interaction => {
|
||||||
if (interaction.isCommand()) {
|
if (interaction.isCommand()) {
|
||||||
const {commandName} = interaction
|
const {commandName} = interaction
|
||||||
|
|
||||||
if (commandName === "games") {
|
if (commandName === "games") {
|
||||||
let embed = new Discord.MessageEmbed()
|
let embed = new Discord.MessageEmbed()
|
||||||
.setTitle("Mini-Jeux")
|
.setTitle("Mini-Jeux")
|
||||||
@@ -70,36 +102,27 @@ Client.on("interactionCreate", async interaction => {
|
|||||||
.addField("__WORlDLE__", "https://worldle.teuteuf.fr/")
|
.addField("__WORlDLE__", "https://worldle.teuteuf.fr/")
|
||||||
.addField("__LETTERS__", "https://edjefferson.com/letterle/ ")
|
.addField("__LETTERS__", "https://edjefferson.com/letterle/ ")
|
||||||
.setTimestamp()
|
.setTimestamp()
|
||||||
await interaction.channel.send({embeds: [embed]})
|
await interaction.reply({embeds: [embed], ephemeral: true})
|
||||||
interaction.reply({content: 'Done ! :white_check_mark:', ephemeral: true,})
|
|
||||||
|
|
||||||
} else if (commandName === "help") {
|
} else if (commandName === "help") {
|
||||||
await interaction.channel.send({embeds: [embedCommands]})
|
await interaction.reply({embeds: [embedCommands], ephemeral: true})
|
||||||
interaction.reply({content: 'Done ! :white_check_mark:', ephemeral: true,})
|
|
||||||
|
|
||||||
} else if (commandName === 'react') {
|
} else if (commandName === 'role') {
|
||||||
const message = await interaction.reply({content: 'Ajout du role : ' + interaction.options._hoistedOptions[0].value, fetchReply: true});
|
let roleId = interaction.options._hoistedOptions[0].value
|
||||||
console.log( interaction.options)
|
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('👍')
|
} else if (commandName === 'flip') {
|
||||||
.then(() => message.react('👎'))
|
let choice = interaction.options._hoistedOptions[0].value
|
||||||
.catch(error => console.error('One of the emojis failed to react:', error))
|
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)
|
Client.login(config.token)
|
||||||
console.log("Successfully reloaded")
|
console.log("Successfully reloaded")
|
||||||
} else if (message.content.indexOf("!") === 0) {
|
} else if (message.content.indexOf("!") === 0) {
|
||||||
let commands = friendsCommands.commands
|
if (message.content.substring(1, 5) === "jean") {
|
||||||
commands.forEach(command => {
|
let arg = strings[Math.floor(Math.random() * strings.length)]
|
||||||
if (message.content.substring(1, message.content.length) === command.key)
|
send(message, arg);
|
||||||
send(message, command.value)
|
} else {
|
||||||
})
|
let commands = friendsCommands.commands
|
||||||
}
|
commands.forEach(command => {
|
||||||
})
|
if (message.content.substring(1, message.content.length) === command.key)
|
||||||
Client.on('messageReactionAdd', async (reaction, user) => {
|
send(message, command.value)
|
||||||
// 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
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user