migrated
This commit is contained in:
@@ -7,11 +7,11 @@ module.exports = {
|
||||
async execute(message, args) {
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const nutsColl = db.collection('items_nuts')
|
||||
const nutsStatsColl = db.collection('stats_nuts')
|
||||
const cdColl = db.collection('items_cooldowns')
|
||||
|
||||
const cdData = await cdColl.findOne({ userID: message.author.id })
|
||||
|
||||
if (cdData || cdData?.cooldown > (Date.now() / 1000)) {
|
||||
if (cdData?.cooldown > (Date.now() / 1000)) {
|
||||
return await message.reply({
|
||||
content: `Du kannst erst <t:${Math.floor(cdData?.cooldown)}:R> wieder nussen :(`,
|
||||
})
|
||||
@@ -21,10 +21,10 @@ module.exports = {
|
||||
await cdColl.findOneAndUpdate({
|
||||
userID: message.author.id
|
||||
}, {
|
||||
$set: {
|
||||
$set: {
|
||||
cooldown: cd,
|
||||
application: 'nuts'
|
||||
}
|
||||
}
|
||||
}, {
|
||||
upsert: true
|
||||
})
|
||||
@@ -39,6 +39,17 @@ module.exports = {
|
||||
upsert: true
|
||||
})
|
||||
|
||||
await nutsStatsColl.findOneAndUpdate(
|
||||
{ userID: message.author.id },
|
||||
{ $inc: { [`stat.${amount}`]: 1 } },
|
||||
{ upsert: true }
|
||||
)
|
||||
|
||||
await nutsStatsColl.findOneAndUpdate(
|
||||
{ userID: "__global" },
|
||||
{ $inc: { [`stat.${amount}`]: 1 } },
|
||||
{ upsert: true }
|
||||
)
|
||||
let content = `Du hast ${amount} Nüsse bekommen! :chestnut:`
|
||||
if (!amount) {
|
||||
content = `Du hast leider keine Nüsse bekommen :(`
|
||||
|
||||
Reference in New Issue
Block a user