Fix phone ratelimits

This commit is contained in:
Dragon Fire
2020-06-10 14:09:47 -04:00
parent 8fbdf79a22
commit 7e0a570b5c
2 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "xiao", "name": "xiao",
"version": "116.15.2", "version": "116.15.3",
"description": "Your personal server companion.", "description": "Your personal server companion.",
"main": "Xiao.js", "main": "Xiao.js",
"scripts": { "scripts": {
+5 -3
View File
@@ -100,10 +100,12 @@ module.exports = class PhoneCall {
if (!this.client.isOwner(msg.author)) { if (!this.client.isOwner(msg.author)) {
const ratelimit = this.ratelimitMeters.get(msg.author.id); const ratelimit = this.ratelimitMeters.get(msg.author.id);
if (!ratelimit) this.ratelimitMeters.set(msg.author.id, 1); if (!ratelimit) this.ratelimitMeters.set(msg.author.id, 1);
if (ratelimit > 2) { if (ratelimit > 1) {
this.cooldown.add(msg.author.id); this.cooldown.add(msg.author.id);
setTimeout(() => this.cooldown.delete(msg.author.id), 10000); setTimeout(() => {
this.ratelimitMeters.set(msg.author.id, 0); this.cooldown.delete(msg.author.id);
this.ratelimitMeters.set(msg.author.id, 0);
}, 10000);
} else { } else {
this.ratelimitMeters.set(msg.author.id, ratelimit + 1); this.ratelimitMeters.set(msg.author.id, ratelimit + 1);
setTimeout(() => this.ratelimitMeters.set(msg.author.id, 0), 5000); setTimeout(() => this.ratelimitMeters.set(msg.author.id, 0), 5000);