Add .joint back in addition to /joint

This commit is contained in:
Skylar Grant 2022-06-20 19:00:42 -04:00
parent a5bc4dc9c7
commit 689ee529e2
2 changed files with 18 additions and 1 deletions

16
dot-commands/joint.js Normal file
View File

@ -0,0 +1,16 @@
const fn = require('../functions.js');
const { emoji } = require('../strings.json');
module.exports = {
name: 'joint',
description: 'Send a random weed-themed phrase.',
usage: '.joint',
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);
message.reply(`${joints[randIndex]} ${emoji.joint}`);
}
}

View File

@ -146,7 +146,8 @@ const functions = {
// Split the message content at the final instance of a period
const finalPeriod = message.content.lastIndexOf('.');
// If the final period is the last character, or doesn't exist
if (finalPeriod <= 0) {
if (finalPeriod < 0) {
if (isDev) console.log(finalPeriod);
commandData.isCommand = false;
return commandData;
}