forked from Spoderal/zero2sixtybotdiscord
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbadges.js
38 lines (29 loc) · 1.55 KB
/
badges.js
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
const db = require('quick.db')
const discord = require("discord.js")
module.exports = (client) => {
client.on('message', message => {
if(message.author.bot) return
const {guild, member} = message
let millionbadge = db.fetch(`millionbadge_${member.id}`)
let cars10badge = db.fetch(`10carsbadge_${member.id}`)
let driftkingbadge = db.fetch(`driftkingbadge_${member.id}`)
let cash = db.fetch(`cash_${member.id}`)
let cars = db.fetch(`cars_${message.author.id}`) || []
let drift = db.fetch(`drifttraining_${member.id}`)
if(cash >= 1000000 && !db.fetch(`millionbadge_${member.id}`)){
message.channel.send(`You just earned the "Millionaire" badge for having 1m cash! Congratulations!`)
db.set(`millionbadge_${member.id}`, true)
db.push(`badges_${member.id}`, "1mcash")
}
if(cars.length >= 10 && !db.fetch(`10carsbadge_${member.id}`)){
message.channel.send(`You just earned the "2ManyCars" badge for having 10 cars or more! Congratulations!`)
db.set(`10carsbadge_${member.id}`, true)
db.push(`badges_${member.id}`, "10cars")
}
if(drift >= 50 && !db.fetch(`driftkingbadge_${member.id}`)){
message.channel.send(`You just earned the "Drift King" badge for having a drift score of 50 or more! Congratulations!`)
db.set(`driftkingbadge_${member.id}`, true)
db.push(`badges_${member.id}`, "driftking")
}
})
}