mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-01-06 23:44:19 +08:00
only annoucing changes if timestamp is within 10 minutes
This commit is contained in:
parent
c24a8c0742
commit
4372276169
1 changed files with 6 additions and 1 deletions
|
|
@ -137,14 +137,19 @@ app.listen(PORT, async () => {
|
|||
.limit(10)
|
||||
.toArray();
|
||||
let changed;
|
||||
let recent = false;
|
||||
for (let index in before60) {
|
||||
if (before60[index].uid !== after60[index].uid) {
|
||||
//something changed at this index
|
||||
if (after60[index].timestamp > Date.now() - 1000 * 60 * 10) {
|
||||
//checking if test is within 10 minutes
|
||||
recent = true;
|
||||
}
|
||||
changed = after60[index];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (changed) {
|
||||
if (changed && recent) {
|
||||
let name = changed.discordId ?? changed.name;
|
||||
BotDAO.announceLbUpdate(
|
||||
name,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue