From 988b4966bb3cf6763408bfb91c8cc32f5c12ce1a Mon Sep 17 00:00:00 2001 From: Mia <49593536+mia-pi-git@users.noreply.github.com> Date: Tue, 27 Oct 2020 14:02:02 -0500 Subject: [PATCH] /show: Throttle requests (#7589) --- server/chat-commands/info.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/chat-commands/info.ts b/server/chat-commands/info.ts index 02c396d029f66..c9fc685c24c22 100644 --- a/server/chat-commands/info.ts +++ b/server/chat-commands/info.ts @@ -2555,9 +2555,12 @@ export const commands: ChatCommands = { return this.parse(`/join view-approvals-${room.roomid}`); }, - async show(target, room, user) { + async show(target, room, user, connection) { if (!room?.persist && !this.pmTarget) return this.errorReply(`/show cannot be used in temporary rooms.`); if (!toID(target).trim()) return this.parse(`/help show`); + if (Monitor.countNetRequests(connection.ip)) { + return this.errorReply(`You are using this command too quickly. Wait a bit and try again.`); + } const [link, comment] = Utils.splitFirst(target, ','); @@ -2598,7 +2601,7 @@ export const commands: ChatCommands = { async registertime(target, room, user, connection) { this.runBroadcast(); if (Monitor.countNetRequests(connection.ip)) { - return this.errorReply(`You are using this command to quickly. Wait a bit and try again.`); + return this.errorReply(`You are using this command too quickly. Wait a bit and try again.`); } if (!user.autoconfirmed) return this.errorReply(`Only autoconfirmed users can use this command.`); target = toID(target);