This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
43 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"version": "3.1.5", | ||
"version": "3.2.0", | ||
"main": "./build/src/Index.js", | ||
"scripts": { | ||
"start": "node .", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"max": 1, | ||
"min": 5, | ||
"upDownPercent": 30 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import memberCollection from "../database/collections/Member"; | ||
import tier from "../../resources/config/tier.json"; | ||
|
||
setInterval(async() => { | ||
const date = new Date(); | ||
|
||
if (date.getDate() === 1 && date.getHours() === 0 && date.getMinutes() === 0) { | ||
// Update member tiers : | ||
const members = (await memberCollection.find({ isOnServer: true }).toArray()).sort((a, b) => { | ||
const aActivity = a.activity.messages.monthCount + a.activity.monthVoiceMinute; | ||
const bActivity = b.activity.messages.monthCount + b.activity.monthVoiceMinute; | ||
|
||
return aActivity < bActivity ? 1 : -1; | ||
}); | ||
|
||
const up = members.slice(0, Math.floor(members.length * tier.upDownPercent / 100)); | ||
const down = members.slice(members.length - Math.floor(members.length * tier.upDownPercent / 100), members.length); | ||
|
||
for (const member of up) { | ||
if (member.activity.tier !== tier.max) await memberCollection.updateOne({ _id: member._id }, { $inc: { "activity.tier": -1 } }); | ||
} | ||
|
||
for (const member of down) { | ||
if (member.activity.tier !== tier.min) await memberCollection.updateOne({ _id: member._id }, { $inc: { "activity.tier": 1 } }); | ||
} | ||
|
||
// Reset member activity : | ||
memberCollection.updateMany({}, { $set: { "activity.messages.monthCount": 0, "activity.monthVoiceMinute": 0 } }); | ||
} | ||
}, 5000); // 60_000 |
This file was deleted.
Oops, something went wrong.