commmenting
Some checks reported warnings
NodBot Production Dockerization / build (pull_request) Has been cancelled

This commit is contained in:
Skylar Grant 2023-12-14 10:54:05 -05:00
parent 97b4136b64
commit 15d39e3381

View File

@ -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'], alias: ['bong', 'blunt', 'bowl', 'pipe', 'dab', 'vape', 'dabs', 'shatter', 'edible', 'edibles', 'doobie', 'spliff', 'gummy', 'gummies', 'hash', 'toke', 'big doinks'],
execute(message, commandData) { execute(message, commandData) {
let joints = []; let joints = [];
// Create a simple array of the joint texts
for (const entry of message.client.joints.map(joint => joint.content)) { for (const entry of message.client.joints.map(joint => joint.content)) {
joints.push(entry); joints.push(entry);
} }
// Generate a random number between 0 and the length of the joints array
let randIndex = Math.floor(Math.random() * joints.length); let randIndex = Math.floor(Math.random() * joints.length);
// Grab the joint text from the array
let joint = joints[randIndex]; let joint = joints[randIndex];
// Check if the joint has already been smoked // Check if the joint has already been smoked
while (message.client.roaches.has(joint)) { while (message.client.roaches.has(joint)) {
// Regenerate a random number and recheck
randIndex = Math.floor(Math.random() * joints.length); randIndex = Math.floor(Math.random() * joints.length);
joint = joints[randIndex]; joint = joints[randIndex];
} }