From 15d39e33816462ceb7e9b183a661b69b355afc1a Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Thu, 14 Dec 2023 10:54:05 -0500 Subject: [PATCH] commmenting --- dot-commands/joint.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dot-commands/joint.js b/dot-commands/joint.js index 939a5e1..9abc9d1 100644 --- a/dot-commands/joint.js +++ b/dot-commands/joint.js @@ -8,14 +8,18 @@ module.exports = { alias: ['bong', 'blunt', 'bowl', 'pipe', 'dab', 'vape', 'dabs', 'shatter', 'edible', 'edibles', 'doobie', 'spliff', 'gummy', 'gummies', 'hash', 'toke', 'big doinks'], execute(message, commandData) { let joints = []; + // Create a simple array of the joint texts for (const entry of message.client.joints.map(joint => joint.content)) { joints.push(entry); } + // Generate a random number between 0 and the length of the joints array let randIndex = Math.floor(Math.random() * joints.length); + // Grab the joint text from the array let joint = joints[randIndex]; // Check if the joint has already been smoked while (message.client.roaches.has(joint)) { + // Regenerate a random number and recheck randIndex = Math.floor(Math.random() * joints.length); joint = joints[randIndex]; }