parent
a459a39a2e
commit
8ba49a228b
@ -0,0 +1,16 @@ |
||||
const Discord = require('discord.js'); |
||||
const fs = require('fs'); |
||||
const chalk = require('chalk'); |
||||
|
||||
module.exports = client => { |
||||
var responses = fs.readdirSync('./responses').filter(file => file.endsWith('.js')); |
||||
console.log(`\n${chalk.gray('[BOOT]')} >> ${chalk.blue('Getting Responses...')}\n`); |
||||
for (let responsef of responses) { |
||||
if (Object.keys(require.cache).includes(require.resolve(`../responses/${responsef}`))) {delete require.cache[require.resolve(`../responses/${responsef}`)];} |
||||
var response = require(`../responses/${responsef}`); |
||||
client.responses.triggers.push([response.name, response.condition]); |
||||
client.responses.commands.set(response.name, response); |
||||
console.log(`${chalk.gray('[LOG] ')} >> ${chalk.blueBright('Loaded Response')} ${chalk.white(response.name)}`); |
||||
} |
||||
console.log(`\n${chalk.gray('[BOOT]')} >> ${chalk.blue('Loaded all Responses')}`); |
||||
}; |
@ -0,0 +1,29 @@ |
||||
const Discord = require('discord.js'); |
||||
|
||||
module.exports = { |
||||
name: "decide", |
||||
meta: { |
||||
category: "", |
||||
perms: "", |
||||
staff: false, |
||||
vip: "", |
||||
serverPerms: [], |
||||
writtenBy: "", |
||||
serverOnly: false |
||||
}, |
||||
tags: [], |
||||
help: new Discord.MessageEmbed() |
||||
.setTitle("Help -> ") |
||||
.setDescription("") |
||||
.addField("Syntax", "``"), |
||||
async condition (message, msg, args, cmd, prefix, mention, client) {return msg.split(/\s+/gm).length > 3 && (msg.startsWith(`<@${client.user.id}>`) || msg.startsWith(`<@!${client.user.id}>`));}, |
||||
async execute(message, msg, args, cmd, prefix, mention, client) { |
||||
let e = message.content.split(/\s+/g); e.shift(); |
||||
let options = e.join(" ").split(/(?:(?:\s+)[oO][rR] [sS][hH][oO][uU][lL][dD] [iI](?:\s+)|,(?:\s*)[oO][rR] [sS][hH][oO][uU][lL][dD] [iI](?:\s+)|(?:\s+)[oO][rR] [dD][oO] [iI](?:\s+)|,(?:\s*)[dD][oO] [iI](?:\s+)|,(?:\s*)[sS][hH][oO][uU][lL][dD] [iI](?:\s+)|,(?:\s*)[oO][rR] [dD][oO] [iI](?:\s+)|,(?:\s*)[oO][rR](?:\s+)|(?:\s+)[oO][rR](?:\s+)|,(?:\s*))/gm); |
||||
//console.log(e, options);
|
||||
if (options.length < 2) {return;} |
||||
let cleanups = ['should i ', 'do i ']; |
||||
let option; for (option of options) {let c; for (c of cleanups) {if (option.trim().toLowerCase().startsWith(c)) {options[options.indexOf(option)] = option.trim().slice(c.length);}}} |
||||
return message.channel.send(`${['You should', 'How about', 'Hmmm... I pick', 'How about you', 'I think you should'][Math.floor(Math.random() * 5)]} ${options[Math.floor(Math.random() * options.length)]}.`); |
||||
} |
||||
}; |
Loading…
Reference in new issue