Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

admin: add feedback for require_privmsg commands #2641

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ComputerTech312
Copy link

Previously .say, .me and .raw didn't provide feedback in the channel of usage to the user but silently just did nothing.

@dgw
Copy link
Member

dgw commented Oct 24, 2024

I think this could go farther.

Several more commands expect to be run in PM, but don't give feedback (e.g. .join, .part, and their tmp counterparts).

Also, the decorator order here now matters. If require_owner or require_admin is silent, it should be the first decorator, last to wrap the function and therefore first to run its checks. Then if the owner/admin check passes, is_privmsg gets a chance to say its error—but not if the user doesn't pass that initial permission check.

That's what we were talking about on IRC, is to have feedback about require_privmsg for these admin commands but only if the user is already authorized to use them. Normal users shouldn't get any response, and the way to accomplish that is to reorder the decorators so perms get checked first.

Huh, unexpectedly it's nice to have a chance to iterate on something without wasting GHA minutes… Wonder if we can treat everyone as a new contributor, even me?

@dgw dgw changed the title Added channel feedback for restrictions of the commands: .say, .me, .raw admin: add feedback for require_privmsg commands Oct 24, 2024
Copy link
Member

@dgw dgw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like I said before (emphasis added):

That's what we were talking about on IRC, is to have feedback about require_privmsg for these admin commands but only if the user is already authorized to use them. Normal users shouldn't get any response

sopel/builtins/admin.py Outdated Show resolved Hide resolved
sopel/builtins/admin.py Outdated Show resolved Hide resolved
sopel/builtins/admin.py Outdated Show resolved Hide resolved
sopel/builtins/admin.py Outdated Show resolved Hide resolved
sopel/builtins/admin.py Outdated Show resolved Hide resolved
sopel/builtins/admin.py Outdated Show resolved Hide resolved
sopel/builtins/admin.py Outdated Show resolved Hide resolved
sopel/builtins/admin.py Outdated Show resolved Hide resolved
sopel/builtins/admin.py Outdated Show resolved Hide resolved
sopel/builtins/admin.py Outdated Show resolved Hide resolved
@ComputerTech312
Copy link
Author

Changed @plugin.require_admin to be silent if called by an unauthorized user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants