Ignore chat triggers for interactive ban reason#2067
Merged
peace-maker merged 2 commits intoalliedmodders:masterfrom Oct 16, 2023
Merged
Ignore chat triggers for interactive ban reason#2067peace-maker merged 2 commits intoalliedmodders:masterfrom
peace-maker merged 2 commits intoalliedmodders:masterfrom
Conversation
If the admin types a chat trigger for a command while BaseBans is waiting for them to type a ban reason, don't treat that message as the ban reason. This fixes a problem where the admin decides to cancel their ban with "!abortban", "/abortban" etc, but ends up accidentally banning the player with the ban reason "!abortban" (or by attempting to access any other command via a chat trigger before typing the ban reason).
asherkin
reviewed
Oct 15, 2023
peace-maker
approved these changes
Oct 16, 2023
asherkin
approved these changes
Oct 16, 2023
Member
asherkin
left a comment
There was a problem hiding this comment.
This is a great little quality of life improvement 👍
psychonic
pushed a commit
that referenced
this pull request
Jun 22, 2024
* Ignore chat triggers for interactive ban reason If the admin types a chat trigger for a command while BaseBans is waiting for them to type a ban reason, don't treat that message as the ban reason. This fixes a problem where the admin decides to cancel their ban with "!abortban", "/abortban" etc, but ends up accidentally banning the player with the ban reason "!abortban" (or by attempting to access any other command via a chat trigger before typing the ban reason). * Optimize Check if we're actually waiting for chat reason before calling the native
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If the admin types a chat trigger for a command while BaseBans is waiting for them to type a ban reason, don't treat that message as the ban reason.
This change fixes a problem where an admin decides to cancel their ban with
sm_abortban, by invoking it via a chat trigger (!abortban,/abortban, etc), but ends up accidentally banning the player with the ban reason!abortban(or by attempting to access any other command via a chat trigger while the basebans chat listener was expecting to receive the ban reason).Steps to reproduce
Admin decides to cancel the ban, point of view:

It feels like substituting the "sm_command" with the "!command" chat trigger should work here. However:
The unfortunate player point of view (banned with reason "!abortban"):

You can attempt to ban yourself to test this behaviour.
After this change
After this commit, any chat trigger messages are ignored for the interactive ban reason, so things like
!abortbanwill work.