mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-12 06:33:22 +08:00
only sending bot command if result is recent
This commit is contained in:
parent
4372276169
commit
e7e5f08bb3
1 changed files with 6 additions and 1 deletions
|
@ -104,14 +104,19 @@ app.listen(PORT, async () => {
|
|||
.toArray();
|
||||
|
||||
let changed;
|
||||
let recent = false;
|
||||
for (let index in before15) {
|
||||
if (before15[index].uid !== after15[index].uid) {
|
||||
//something changed at this index
|
||||
if (after15[index].timestamp > Date.now() - 1000 * 60 * 10) {
|
||||
//checking if test is within 10 minutes
|
||||
recent = true;
|
||||
}
|
||||
changed = after15[index];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (changed) {
|
||||
if (changed && recent) {
|
||||
let name = changed.discordId ?? changed.name;
|
||||
BotDAO.announceLbUpdate(
|
||||
name,
|
||||
|
|
Loading…
Reference in a new issue