Skip to content

Commit

Permalink
/show: Throttle requests (smogon#7589)
Browse files Browse the repository at this point in the history
  • Loading branch information
mia-pi-git authored and Quanyails committed May 12, 2021
1 parent 86eed49 commit 988b496
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server/chat-commands/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, ',');

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 988b496

Please sign in to comment.