1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// TODO: get this working someday
import { Command, CommandoMessage } from 'discord.js-commando';
import emoji from 'emoji-random';
module.exports = class MathUtility extends Command {
constructor(client) {
super(client, {
name: 'math',
group: 'utility',
memberName: 'math',
description: 'Allows you to do simple math operations.',
args: [
{
key: 'mVal1',
prompt: 'First number?',
type: 'integer'
},
{
key: 'mOp',
prompt: 'What operation would you like to use?',
type: 'string'
},
{
key: 'mVal2',
prompt: 'Second number?',
type: 'integer'
}
],
examples: [
'uwu!math 5 + 2'
]
});
}
async run(msg: CommandoMessage, { mVal1, mOp, mVal2 }) {
if (!mVal1 || !mOp || !mVal2) {
msg.reply('You are missing a critical part of the operation, please try again.')
} else {
var mSol
switch (mOp) {
case mOp = '+':
if (mVal1 < mVal2) mSol = mVal1 + mVal1;
break
case mOp = '-':
mSol = mVal1 - mVal1;
break
case mOp = '/':
mSol = mVal1 / mVal1;
break
case mOp = '*' || 'x':
mSol = mVal1 * mVal1;
break
}
await msg.reply(`**${mVal1}** ${mOp} **${mVal2}** = **${mSol}**.`)
}
}
};
|