summaryrefslogtreecommitdiff
path: root/src/commands/utility/average.ts
diff options
context:
space:
mode:
author8cy <[email protected]>2020-06-27 22:52:54 -0700
committer8cy <[email protected]>2020-06-27 22:52:54 -0700
commit80951013e391aab140800e4f386867e6c391553f (patch)
tree3d7101237ef1cd8d6fe2a2fab751a2dc55ae7d84 /src/commands/utility/average.ts
parentmore config shit (diff)
downloaddep-core-80951013e391aab140800e4f386867e6c391553f.tar.xz
dep-core-80951013e391aab140800e4f386867e6c391553f.zip
add ts defs so not a lot of errors left
- made .todo file for epic error tracking
Diffstat (limited to 'src/commands/utility/average.ts')
-rw-r--r--src/commands/utility/average.ts13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/commands/utility/average.ts b/src/commands/utility/average.ts
index 51ac9e6..233236c 100644
--- a/src/commands/utility/average.ts
+++ b/src/commands/utility/average.ts
@@ -1,10 +1,13 @@
-import { Command, CommandoMessage } from 'discord.js-commando';
+import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando';
+//@ts-ignore no types
import emoji from 'emoji-random'
import { formatDistance, formatRelative } from 'date-fns'
+//TODO: check if this has types
+//@ts-ignore no types
import { stripIndents } from 'common-tags'
module.exports = class AverageUtility extends Command {
- constructor(client) {
+ constructor(client: CommandoClient) {
super(client, {
name: 'average',
aliases: [
@@ -34,10 +37,10 @@ module.exports = class AverageUtility extends Command {
]
});
}
- async run(msg: CommandoMessage, { nNum }) {
+ async run(msg: CommandoMessage, { nNum }: any) { // this is really a string
if (nNum.length < 2) msg.reply('Please provide **2** or more numbers.')
- const reducer = (accumulator, currentValue) => accumulator + currentValue
- msg.reply(`The average of the specified numbers is ${nNum.reduce(reducer) / nNum.length}.` + ' ' + emoji.random())
+ const reducer = (accumulator: any, currentValue: any) => accumulator + currentValue
+ return msg.reply(`The average of the specified numbers is ${nNum.reduce(reducer) / nNum.length}.` + ' ' + emoji.random())
}
}; \ No newline at end of file