-
-
Notifications
You must be signed in to change notification settings - Fork 683
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
Give help thread owners ability to use !title
command.
#2772
Conversation
Previously, only staff members could use the command. The implementation is a bit fragile as it depends on short-circuiting `commands.has_any_role(constants.Roles.helpers).predicate(ctx)` in the case that the user is not the OP, which would raise an exception for non-staffers instead of returning False.
bot/exts/help_channels/_cog.py
Outdated
|
||
if ( | ||
ctx.author.id == ctx.channel.owner_id | ||
or await commands.has_any_role(constants.Roles.helpers).predicate(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we could use this utility function? Suggested by @TizzySaurus
or await commands.has_any_role(constants.Roles.helpers).predicate(ctx) | |
or has_any_role_check(ctx, constants.Roles.helpers) |
has_any_role_check
would need to be imported from bot.utils.checks import has_any_role_check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that solves the "The implementation is a bit fragile as it depends on short-circuiting ..." problem, then I support it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for @Robin5605 's suggestion but LGTM
I'm going to refactor and push another commit--do not merge yet. |
The latter will raise an error instead of returning False, whereas the former will return a bool in either case, which is more appropriate here.
…p' into swfarnsworth/title-command-for-op
if not (user_is_op or user_is_staff): | ||
return | ||
|
||
await ctx.channel.edit(name=title) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not (user_is_op or user_is_staff): | |
return | |
await ctx.channel.edit(name=title) | |
if user_is_op or user_is_staff: | |
await ctx.channel.edit(name=title) |
I think not using a negative here makes the intent clearer
No longer needed since #2774 was merged. |
Previously, only staff members could use the command. The implementation is a bit fragile as it depends on short-circuiting
commands.has_any_role(constants.Roles.helpers).predicate(ctx)
in the case that the user is not the OP, which would raise an exception for non-staffers instead of returning False.