diff --git a/config.json b/config.json index b9087cf..467e255 100644 --- a/config.json +++ b/config.json @@ -1,4 +1,5 @@ { "guildId": "868542949737246730", - "validCommands": [] + "validCommands": [], + "roaches": [] } \ No newline at end of file diff --git a/dot-commands/joint.js b/dot-commands/joint.js index 2ce3202..939a5e1 100644 --- a/dot-commands/joint.js +++ b/dot-commands/joint.js @@ -5,13 +5,29 @@ module.exports = { name: 'joint', description: 'Send a random weed-themed phrase.', usage: '.joint', - alias: ['bong', 'blunt', 'bowl', 'pipe'], + alias: ['bong', 'blunt', 'bowl', 'pipe', 'dab', 'vape', 'dabs', 'shatter', 'edible', 'edibles', 'doobie', 'spliff', 'gummy', 'gummies', 'hash', 'toke', 'big doinks'], execute(message, commandData) { let joints = []; for (const entry of message.client.joints.map(joint => joint.content)) { joints.push(entry); } - const randIndex = Math.floor(Math.random() * joints.length); + let randIndex = Math.floor(Math.random() * joints.length); + let joint = joints[randIndex]; + + // Check if the joint has already been smoked + while (message.client.roaches.has(joint)) { + randIndex = Math.floor(Math.random() * joints.length); + joint = joints[randIndex]; + } + // Send the joint message.reply(`${joints[randIndex]} ${emoji.joint}`); + // Check how full the roach collection is + if (message.client.roaches.size / joints.length >= 0.85) { + // If the roach collection is 85% of the joints collection + // Empty it out + message.client.roaches.clear(); + } + // Add the joint to the roach collection + message.client.roaches.set(joint, "baked"); } } \ No newline at end of file diff --git a/functions.js b/functions.js index 101b86e..870c942 100644 --- a/functions.js +++ b/functions.js @@ -149,7 +149,7 @@ const functions = { if (isDev) console.log('Strains Collection Built'); }, medicalAdvice(rows, client) { - if (!client.medicalAdviceCol) client.medicalAdviceColl = new Discord.Collection(); + if (!client.medicalAdviceColl) client.medicalAdviceColl = new Discord.Collection(); client.medicalAdviceColl.clear(); for (const row of rows) { const medicalAdvice = { @@ -160,6 +160,11 @@ const functions = { } if (isDev) console.log('Medical Advice Collection Built'); }, + roaches(client) { + if (!client.roaches) client.roaches = new Discord.Collection(); + client.roaches.clear(); + if (isDev) console.log('Medical Advice Collection Built'); + } }, dot: { getCommandData(message) { diff --git a/main.js b/main.js index ed084ef..584a89c 100644 --- a/main.js +++ b/main.js @@ -34,6 +34,7 @@ client.once('ready', () => { fn.collections.slashCommands(client); fn.collections.dotCommands(client); fn.collections.setvalidCommands(client); + fn.collections.roaches(client); fn.download.gifs(client); fn.download.pastas(client); fn.download.joints(client); @@ -222,8 +223,11 @@ client.on('messageCreate', message => { // Wildcard Responses, will respond if any message contains the trigger word(s), excluding self-messages const lowerContent = message.content.toLowerCase(); + // big + doinks if (lowerContent.includes('big') && lowerContent.includes('doinks')) message.reply('gang.'); + // ligma if (lowerContent.includes('ligma')) message.reply('ligma balls, goteem'); + // frfr, fr fr , bussin, ong if (lowerContent.includes('frfr') || lowerContent.includes('fr fr') || lowerContent.includes('bussin') || lowerContent.includes(' ong') || lowerContent.startsWith('ong')) { const randIndex = Math.floor(Math.random() * strings.capbacks.length); message.reply(strings.capbacks[randIndex]);