Add .joint back in addition to /joint
This commit is contained in:
parent
a5bc4dc9c7
commit
689ee529e2
16
dot-commands/joint.js
Normal file
16
dot-commands/joint.js
Normal 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}`);
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user