From 84df643d9ea8b3ad2b71da53b0fed63d7392b4c6 Mon Sep 17 00:00:00 2001 From: Matthias Guillitte Date: Wed, 31 Jul 2024 17:04:36 +0200 Subject: [PATCH] Updated keywords --- handlers/functions.js | 11 ++++++---- keywords/bsr.js | 4 +--- keywords/freaky.js | 50 +++++++++++++++++++++++++++++++++++++++++++ keywords/gambling.js | 48 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 106 insertions(+), 7 deletions(-) create mode 100644 keywords/freaky.js create mode 100644 keywords/gambling.js diff --git a/handlers/functions.js b/handlers/functions.js index c410703..f01833f 100755 --- a/handlers/functions.js +++ b/handlers/functions.js @@ -16,7 +16,7 @@ module.exports = { console.log(String(e.stack).bgRed) } }, - //changeging the duration from ms to a date + //changing the duration from ms to a date duration: function(ms) { const sec = Math.floor((ms / 1000) % 60).toString(); const min = Math.floor((ms / (60 * 1000)) % 60).toString(); @@ -55,7 +55,7 @@ module.exports = { try{ return Math.floor(Math.random() * Math.floor(max)); }catch (e){ - console.log(String(e.stack).bgRed) + console.error(String(e.stack).bgRed) } }, //random number between y and x @@ -63,7 +63,7 @@ module.exports = { try{ return Math.floor(Math.random() * Math.floor((max - min) + min)); }catch (e){ - console.log(String(e.stack).bgRed) + console.error(String(e.stack).bgRed) } }, //function for creating a bar @@ -73,7 +73,7 @@ module.exports = { if (!String(bar).includes("🔶")) return `**[🔶${line.repeat(size - 1)}]**\n**00:00:00 / 00:00:00**`; return `**[${bar[0]}]**\n**${new Date(currenttime).toISOString().substr(11, 8)+" / "+(maxtime==0?" ◉ LIVE":new Date(maxtime).toISOString().substr(11, 8))}**`; }catch (e) { - console.log(String(e.stack).bgRed) + console.error(String(e.stack).bgRed) } }, format: function(millis) { @@ -116,6 +116,9 @@ module.exports = { isNinluc: function (id) { return id == "417731861033385985"; }, + isLama: function (guildId) { + return guildId == "1114242845692403773"; + }, /** * Gives an random element from the array given. * @param {array} array The array to choose an element from diff --git a/keywords/bsr.js b/keywords/bsr.js index d6d579e..d24336d 100644 --- a/keywords/bsr.js +++ b/keywords/bsr.js @@ -13,9 +13,7 @@ module.exports = { // If it has mentions → return nothing if (message.mentions.members.size) {return;} - - - var answers = ["Bonsoir 🌙", `bsr ${message.author}`, "bsr Figue..."]; + var answers = ["Bonsoir 🌙", `bsr ${message.author}`]; return message.channel.send({ content : choose(answers)}) diff --git a/keywords/freaky.js b/keywords/freaky.js new file mode 100644 index 0000000..dff576c --- /dev/null +++ b/keywords/freaky.js @@ -0,0 +1,50 @@ +const { MessageEmbed, Message } = require("discord.js"); +const config = require("../botconfig/config.json"); +const ee = require("../botconfig/embed.json"); +const { + getRandomInt, + choose, + isNinluc, + isLama, +} = require("../handlers/functions"); + +module.exports = { + keyword: "freaky", + regex: /^.{0,5}(freak|freaky).{0,17}$/i, + cooldown: 3, + random: 80, + run: async (client, message, user) => { + try { + if (getRandomInt(2) == 1) { + // Reaction + let reactionEmojis = ["😏", "👀"]; + if (isLama(message.guildId)) { + reactionEmojis.push("<:freaky:1266759402417819668>"); + } + return message.react(choose(reactionEmojis)); + } else { + var answers = [ + "Oil up bro", + "Prepare I'm coming to your house 🚗", + "Better be oiled up when I'm here 👀", + "On dirait bien que qelqu'un est un peu 𝓯𝓻𝓮𝓪𝓴𝔂 par ici 😜", + ]; + + return message.channel.send({ content: choose(answers) }); + } + } catch (e) { + console.log(String(e.stack).bgRed); + return message.channel.send({ + embeds: [ + new MessageEmbed() + .setColor(ee.wrongcolor) + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) + .setTitle(`❌ ERREUR | Une erreur est survenue : `) + .setDescription(`\`\`\`${e.stack}\`\`\``), + ], + }); + } + }, +}; + +/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */ diff --git a/keywords/gambling.js b/keywords/gambling.js new file mode 100644 index 0000000..a95997a --- /dev/null +++ b/keywords/gambling.js @@ -0,0 +1,48 @@ +const { MessageEmbed, Message } = require("discord.js"); +const config = require("../botconfig/config.json"); +const ee = require("../botconfig/embed.json"); +const { + getRandomInt, + choose, + isNinluc, + isLama, +} = require("../handlers/functions"); + +module.exports = { + keyword: "gambling", + regex: /^.{0,5}(gambling|gamble).{0,17}$/i, + cooldown: 3, + random: 80, + run: async (client, message, user) => { + try { + if (getRandomInt(2) == 1) { + // Reaction + let reactionEmojis = ["😏", "👀", "🎲", "🎰", "🤑"]; + if (isLama(message.guildId)) { + reactionEmojis.push("<:image:1114257700038119506>"); + } + return message.react(choose(reactionEmojis)); + } else { + var answers = [ + "Gambliiing", + "🤑" + ]; + + return message.channel.send({ content: choose(answers) }); + } + } catch (e) { + console.log(String(e.stack).bgRed); + return message.channel.send({ + embeds: [ + new MessageEmbed() + .setColor(ee.wrongcolor) + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) + .setTitle(`❌ ERREUR | Une erreur est survenue : `) + .setDescription(`\`\`\`${e.stack}\`\`\``), + ], + }); + } + }, +}; + +/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */