Skip to content

Commit

Permalink
fix api reference
Browse files Browse the repository at this point in the history
  • Loading branch information
tgoins committed Apr 13, 2018
1 parent d7f1582 commit bb91fdc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions dist/lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/lib/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import { Module } from '../'
import { Logger } from '@natsuki/util'
import { User as NatsukiUser } from '@natsuki/db'

const { api } = Module.config
const timeForExp = 60 * 1000
const minExpPerMessage = 15
const maxExpPerMessage = 25
const baseRoute = `${api.address}/users`

const getRandomNumber = (min: number, max: number) => {
return Math.floor(Math.random() * (max - min + 1)) + min
Expand All @@ -23,6 +21,9 @@ export const giveXp = async (user: NatsukiUser, message: Message) => {
return
}

const { api } = Module.config
const baseRoute = `${api.address}/users`

const timeDiff: number = Date.now() - user.level.timestamp.getTime()

if (timeDiff < timeForExp) {
Expand Down Expand Up @@ -52,6 +53,7 @@ export const giveXp = async (user: NatsukiUser, message: Message) => {
const rewardAmount = getRandomNumber(45, 55) + level * 1.25
message.channel.send(`**${popcornEmoji} | ${message.member.displayName} just advanced to level ${level} and earned ${dollarEmoji} ${rewardAmount} credits!**`)

// TODO: Uncomment when API supports User Balance.
// user.money.balance += 50
// user.money.netWorth += 50
// await userController.updateBalance(message.member.id, user.money.balance, user.money.networth).catch(Logger.error)
Expand Down

0 comments on commit bb91fdc

Please sign in to comment.