removed original commented code
This commit is contained in:
parent
267e4e200e
commit
4ee231e726
|
@ -1,35 +1,3 @@
|
||||||
/*
|
|
||||||
exports.run = (bot, msg, args) => {
|
|
||||||
if (args.length < 1) {
|
|
||||||
throw 'You must provide a equation to be solved on the calculator';
|
|
||||||
}
|
|
||||||
|
|
||||||
const question = args.join(' ');
|
|
||||||
|
|
||||||
let answer;
|
|
||||||
try {
|
|
||||||
answer = math.eval(question);
|
|
||||||
} catch (err) {
|
|
||||||
throw `Invalid math equation: ${err}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
msg.delete();
|
|
||||||
msg.channel.send({
|
|
||||||
embed: bot.utils.embed('', stripIndents`
|
|
||||||
**Equation:**\n\`\`\`\n${question}\n\`\`\`
|
|
||||||
**Answer:**\n\`\`\`\n${answer}\n\`\`\`
|
|
||||||
`)
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.info = {
|
|
||||||
name: 'calculate',
|
|
||||||
usage: 'calculate <equation>',
|
|
||||||
aliases: ['calc', 'math'],
|
|
||||||
description: 'Calculates any math equation',
|
|
||||||
credits: 'Carbowix',
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
const math = require('math-expression-evaluator');
|
const math = require('math-expression-evaluator');
|
||||||
const stripIndents = require('common-tags').stripIndents;
|
const stripIndents = require('common-tags').stripIndents;
|
||||||
|
|
||||||
|
|
|
@ -1,57 +1,3 @@
|
||||||
/*
|
|
||||||
const makeCommand = method => {
|
|
||||||
return (bot, msg, args) => {
|
|
||||||
if (args.length < 1) {
|
|
||||||
throw 'Please provide a word to search!';
|
|
||||||
}
|
|
||||||
|
|
||||||
const parsed = bot.utils.parseArgs(args, ['e']);
|
|
||||||
const word = parsed.leftover.join(' ');
|
|
||||||
|
|
||||||
webdict(method, word).then(res => {
|
|
||||||
let result;
|
|
||||||
if (!res || !res.definition || !res.definition[0]) {
|
|
||||||
result = 'No results found.';
|
|
||||||
} else {
|
|
||||||
result = res.definition[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (parsed.options.e) {
|
|
||||||
msg.edit(result);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
msg.delete();
|
|
||||||
msg.channel.send({
|
|
||||||
embed: bot.utils.embed(`:book: ${word}`, result)
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = [
|
|
||||||
{
|
|
||||||
run: makeCommand('dictionary'),
|
|
||||||
info: {
|
|
||||||
name: 'dictionary',
|
|
||||||
aliases: ['dict'],
|
|
||||||
usage: 'dictionary <word>',
|
|
||||||
description: 'Looks a word up in the dictionary.',
|
|
||||||
credits: 'NITEHAWK'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
run: makeCommand('urbandictionary'),
|
|
||||||
info: {
|
|
||||||
name: 'urban',
|
|
||||||
usage: 'urban <word>',
|
|
||||||
description: 'Looks a word up in the urban dictionary.',
|
|
||||||
credits: 'NITEHAWK'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
];
|
|
||||||
*/
|
|
||||||
|
|
||||||
const webdict = require('webdict');
|
const webdict = require('webdict');
|
||||||
|
|
||||||
exports.run = async (client, message, args, level) => {
|
exports.run = async (client, message, args, level) => {
|
||||||
|
|
Loading…
Reference in New Issue