summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author8cy <[email protected]>2020-04-25 19:03:00 -0700
committer8cy <[email protected]>2020-04-25 19:03:00 -0700
commit71e7fb78a83cb882aaeaa1786feb68d03dd4b1d8 (patch)
treee53cba25ba80ec3ed6cacf0bb0889d04bec625f6
parentmove music manager to import, v7.7.0 (diff)
downloaddep-core-71e7fb78a83cb882aaeaa1786feb68d03dd4b1d8.tar.xz
dep-core-71e7fb78a83cb882aaeaa1786feb68d03dd4b1d8.zip
add math todo
-rw-r--r--fix/utility/math.ts56
1 files changed, 56 insertions, 0 deletions
diff --git a/fix/utility/math.ts b/fix/utility/math.ts
new file mode 100644
index 0000000..a55edf1
--- /dev/null
+++ b/fix/utility/math.ts
@@ -0,0 +1,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}**.`)
+ }
+ }
+}; \ No newline at end of file