forked from Galactic/modmail
logic stuff
This commit is contained in:
parent
907540236b
commit
a7e1a9dd86
@ -111,14 +111,7 @@ class Modmail {
|
|||||||
if (!member) return; // No member object found in main or bans server?
|
if (!member) return; // No member object found in main or bans server?
|
||||||
|
|
||||||
const now = Math.floor(Date.now() / 1000);
|
const now = Math.floor(Date.now() / 1000);
|
||||||
const lastActivity = this.client.cache.lastActivity[author.id];
|
const { cache } = this;
|
||||||
// console.log(now - lastActivity, lastActivity, now)
|
|
||||||
if (!lastActivity || now - lastActivity > 30 * 60) {
|
|
||||||
await author.send(`Thank you for your message, we'll get back to you soon!`);
|
|
||||||
}
|
|
||||||
this.client.cache.lastActivity[author.id] = now;
|
|
||||||
|
|
||||||
const { cache } = this.client;
|
|
||||||
|
|
||||||
// Anti spam
|
// Anti spam
|
||||||
if (!this.spammers[author.id]) this.spammers[author.id] = { start: now, count: 1, timeout: false, warned: false };
|
if (!this.spammers[author.id]) this.spammers[author.id] = { start: now, count: 1, timeout: false, warned: false };
|
||||||
@ -135,6 +128,12 @@ class Modmail {
|
|||||||
} else if (now - this.spammers[author.id].start > 15) this.spammers[author.id] = { start: now, count: 1, timeout: false, warned: false };
|
} else if (now - this.spammers[author.id].start > 15) this.spammers[author.id] = { start: now, count: 1, timeout: false, warned: false };
|
||||||
else this.spammers[author.id].count++;
|
else this.spammers[author.id].count++;
|
||||||
|
|
||||||
|
const lastActivity = this.cache.lastActivity[author.id];
|
||||||
|
if (!lastActivity || now - lastActivity > 30 * 60) {
|
||||||
|
await author.send(`Thank you for your message, we'll get back to you soon!`);
|
||||||
|
}
|
||||||
|
this.cache.lastActivity[author.id] = now;
|
||||||
|
|
||||||
if (this.disabled) {
|
if (this.disabled) {
|
||||||
let reason = `Modmail has been disabled for the time being`;
|
let reason = `Modmail has been disabled for the time being`;
|
||||||
if (this.disabledReason) reason += ` for the following reason:\n\n${this.disabledReason}`;
|
if (this.disabledReason) reason += ` for the following reason:\n\n${this.disabledReason}`;
|
||||||
|
Loading…
Reference in New Issue
Block a user