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

[Warnings] Make [p]warnings usable on base of permissions #3327

Merged
merged 8 commits into from Jan 13, 2020

Conversation

@Dav-Git
Copy link
Contributor

Dav-Git commented Jan 10, 2020

Type

  • Bugfix
  • Enhancement
  • New feature

Description of the changes

Makes [p]warnings work with permissions and introduces [p]mywarnings with the functionality described in #2900

Dav-Git added 4 commits Jan 10, 2020
Added the admin check to warnings and removed the part where the user could check themselves.

Added new mywarns which replaces part of the old behaviour of warn
@Dav-Git Dav-Git requested review from palmtree5 and Twentysix26 as code owners Jan 10, 2020
@jack1142

This comment has been minimized.

Copy link
Member

jack1142 commented Jan 10, 2020

Changelog contains wrong command names + I think changelogs should be separated into 2 files - 2900.enhance.1.rst and 2900.enhance.2.rst (though I heard today it might not be necessary so someone please confirm this)

Because appearently I can't remember a command for 10 seconds
@Dav-Git

This comment has been minimized.

Copy link
Contributor Author

Dav-Git commented Jan 10, 2020

Wasn't sure on 2 files. I thought 1 file works

Put command names in changelog in double backticks after being advised to do so in discord
if not await is_admin_or_superior(self.bot, ctx.author):
return await ctx.send(
warning(_("You are not allowed to check warnings for other users!"))
await ctx.send(_("Please provide a user you want to check the warnings for."))

This comment has been minimized.

Copy link
@mikeshardmind

mikeshardmind Jan 13, 2020

Member

This should either return here, or be removed entirely and remove the optional nature of the user argument (probably the latter, but either would be fine)

This comment has been minimized.

Copy link
@Dav-Git

Dav-Git Jan 13, 2020

Author Contributor

Would removing the "Optional" part of the argument fix this?

This comment has been minimized.

Copy link
@jack1142

jack1142 Jan 13, 2020

Member

Yes, making the argument required and removing handling for user is None would fix this.
(adding again, cause I accidentally removed the comment)

await ctx.send(_("Please provide a user you want to check the warnings for."))

msg = ""
member_settings = self.config.member(user)

This comment has been minimized.

Copy link
@mikeshardmind

mikeshardmind Jan 13, 2020

Member

This doesn't properly account for the possibility a user id was passed without it being to a current user (and needs to)

This comment has been minimized.

Copy link
@Dav-Git

Dav-Git Jan 13, 2020

Author Contributor

Honestly I have no idea how to go about this.

This comment has been minimized.

@Dav-Git

This comment has been minimized.

Copy link
Contributor Author

Dav-Git commented Jan 13, 2020

I think that's what you had in mind?

@Dav-Git Dav-Git requested a review from mikeshardmind Jan 13, 2020
msg = ""
member_settings = self.config.member(user)
async with member_settings.warnings() as user_warnings:

try:

This comment has been minimized.

Copy link
@mikeshardmind

mikeshardmind Jan 13, 2020

Member

Not exactly what I meant...

The git diff here is doing some slight disfavors in discussing review as it's recognizing the code for mywarnings now matches the old warnings more closely.

The handling for if a user id not a user was passed isn't needed in mywarnings but is needed in warnings (prior to interacting with config)

@Dav-Git Dav-Git requested a review from mikeshardmind Jan 13, 2020
Copy link
Member

mikeshardmind left a comment

Thanks!

@mikeshardmind mikeshardmind merged commit 90c0f76 into Cog-Creators:V3/develop Jan 13, 2020
2 checks passed
2 checks passed
Lint Python
Details
Travis CI - Pull Request Build Passed
Details
@Dav-Git Dav-Git deleted the Dav-Git:fix-warnings-for-mods branch Jan 13, 2020
Drapersniper added a commit to Drapersniper/Red-DiscordBot that referenced this pull request Jan 16, 2020
…rs#3327)

* new code

Added the admin check to warnings and removed the part where the user could check themselves.

Added new mywarns which replaces part of the old behaviour of warn

* Update warnings.py

* Create 2900.enhance.rst

* Fixed command name

Because appearently I can't remember a command for 10 seconds

* Commands in backticks

Put command names in changelog in double backticks after being advised to do so in discord

* made user not optional, and the other thing sinbad requested

* switched parts. magic

resolves Cog-Creators#2900
flaree added a commit to flaree/Red-DiscordBot that referenced this pull request Jan 18, 2020
* [Docs] Add "Fork me on GitHub" ribbon (Cog-Creators#3306)

* docs: add "Fork me on GitHub" ribbon

* chore(changelog): add towncrier entry

* [Docs] Update Debian/Raspbian instructions (Cog-Creators#3352)

* Update install_linux_mac.rst

* Update install_linux_mac.rst

* Update install_linux_mac.rst

* [Audio] Hotfix an edge case where an attribute error can be raised (Cog-Creators#3328)

* Limit Playlists

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Hotfix

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Hotfix

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* chore (Cog-Creators#3348)

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* [3.2.3][Audio] Full fix for Cog-Creators#3328 (Cog-Creators#3355)

* Limit Playlists

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Hotfix

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Hotfix

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* [Audio] Hotfix an edge case where an attribute error can be raised (Cog-Creators#3328)

* Limit Playlists

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Hotfix

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Hotfix

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* flame's review

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Delete 3328.hotfix.1.rst

* lets be extra safe here

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* [Docs] Update autostart guides to use `-O` flag (Cog-Creators#3354)

* Update autostart_systemd.rst

* Update autostart_pm2.rst

* ... (Cog-Creators#3350)

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* [3.2.3][Docs]Only support venv and virtualenv users (Cog-Creators#3351)

* Limit Playlists

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* docs

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* jack

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* update pip

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* flame's review

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* [Admin] Fixes hierarchy issues in [p]selfrole and [p]selfroleset (Cog-Creators#3331)

* More fixes

* Update admin.py

* [3.2.3][Audio] Improved Playlist cooldowns (Cog-Creators#3342)

* Improved Playlist cooldowns

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Improved Playlist cooldowns

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* formatting

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* [3.2.3][Audio] Fixes some Playlists strings (Cog-Creators#3347)

* chore

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* chore

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* [Downloader] Improve partial-uninstall message in `[p]cog uninstall` (Cog-Creators#3343)

* Update downloader.py

* Let's use more of Flame's suggestions.

Co-authored-by: Flame442 <34169552+Flame442@users.noreply.github.com>

Co-authored-by: Flame442 <34169552+Flame442@users.noreply.github.com>

* Update install_linux_mac.rst (Cog-Creators#3336)

* why the hell is this here (Cog-Creators#3357)

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* [3.2.3][Audio] Correct an unsupported LoadType (Cog-Creators#3337)

* Limit Playlists

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* logging improvements

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* logging improvements

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* sigh

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* chore

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Make Red shutdown when resetting token (Cog-Creators#3358)

* Update __main__.py

* Update __main__.py

* Start making use of typehints for devs (Cog-Creators#3335)

* Start making use of typehints for devs

* changelog

* Add a command to set the bot description (Cog-Creators#3340)

* description-command

* Cap the description length

* mmk

* Exit code handling (Cog-Creators#3360)

* Exit code handling

* clear up a docstring

* [Help] formatting additions (Cog-Creators#3339)

* formatting additions

* I really need to redo this module later

* fix some casing

* [Warnings] Make [p]warnings usable on base of permissions (Cog-Creators#3327)

* new code

Added the admin check to warnings and removed the part where the user could check themselves.

Added new mywarns which replaces part of the old behaviour of warn

* Update warnings.py

* Create 2900.enhance.rst

* Fixed command name

Because appearently I can't remember a command for 10 seconds

* Commands in backticks

Put command names in changelog in double backticks after being advised to do so in discord

* made user not optional, and the other thing sinbad requested

* switched parts. magic

resolves Cog-Creators#2900

* [Docs] Add links to operating systems + minor readability improvements (Cog-Creators#3365)

* add operating systems links + some minor readability improvements

* meh, let's add this too, draper

* stop messing with distutils's internal just to copy directory (Cog-Creators#3364)

* Update bank.py (Cog-Creators#3366)

* Globally ensure send_messages for commands (Cog-Creators#3361)

* wew

* typo fix, thanks Danny

* [Changelog] Clarify breaking change related to `setup()` function (Cog-Creators#3367)

* Update changelog_3_2_0.rst

* Update changelog_3_2_0.rst

* Update changelog_3_2_0.rst

* [Docs] Modlog Example: action -> action_type (Cog-Creators#3368)

* action -> action_type

* Changelog.

* Allow pre_invoke to be used by 3rd party cogs safely. (Cog-Creators#3369)

* Okay, so there's a lot in this diff

* fix docstrings

* meh

* fix misleading var name

* meh...

* useful typehints

* Apply suggestions from code review

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* dep warn in locations suitable

* Fix this...

* Apply suggestions from code review

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update install_linux_mac.rst (Cog-Creators#3371)

* enhance(downloader): log git commands that failed (Cog-Creators#3372)

* Update __init__.py (Cog-Creators#3381)

Removed redundant check.

* [Setup] Fix data deletion. (Cog-Creators#3384)

* I'm ready to 🔪 some of these entrypoints

* If we're gonna teardown here, may as well do it right

* [Typo Fix] Permissions (Cog-Creators#3390)

* [Typo Fix] Permissions

* Changelog file

* enhance(downloader): pagify any output that might be too long (Cog-Creators#3388)

* [Core] Adds server IDs to servers command. (Cog-Creators#3393)

* [Core] Adds server ID to servers command.

* Changelog

* [Audio] Add backticks to commands in docstrings, fix Cog-CreatorsGH-3140 (Cog-Creators#3374)

* docstring change

* remove backticks

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Seems like i cant read

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Rename 3140.enchance.1.rst to 3140.enhance.1.rst

* Update auto_labeler.yml (Cog-Creators#3396)

* Cache prefixes (Cog-Creators#3150)

* Cache prefixes

 - This works towards Cog-Creators#3148
 - Ends up centralizing some logic
   - Including that prefixes should be a reverse sorted list

* handle global prefix attempts at none

* fix prefix set for server

* cache using guild id

* [Audio] Show correct time remaining for bumped tracks (Cog-Creators#3375)

* Fixes Bump play

* *sigh*

* More exit tweaks (Cog-Creators#3392)

* [Audio] Show symbolic link folders (Cog-Creators#3376)

* Fixes Bump play

* Fixed Cog-Creators#3332

* Revert "Fixed Cog-Creators#3332"

This reverts commit d76d3ac

* Revert "Fixes Bump play"

This reverts commit 3839bda

* *sigh*

* *sigh*

* *sigh*

* use iglob + async iterator

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* black

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

*  + fixes

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Stop special casing help in bot.embed_requested (Cog-Creators#3382)

- However, we are not changing the signature
  - This was previously special cased for reasons related to the older
  version of the help formatter we used and never re-evaluated for need.
  - We should leave the signature as is both for lack of breaking, and
  for potential future changes

// actually this was already done once in Cog-CreatorsGH-2966 but got accidentally overwritten

* [Docs] Remaining doc improvements for 3.2.3 (Cog-Creators#3400)

* double the fun

* double

* pluralize this

* [Modlog API] Add resolution for people inpacted by bad casetypes (Cog-Creators#3333)

* add resolution for people inpacted by bad casetypes

* *some* amount of notice on this

* Fine.

* clearer warnings

* actually, unnneded

* [Docs] Changed python version references on docs (Cog-Creators#3402)

* [Docs] Changes Python references to Python 3.8

* [Misc] Remove obsolete mention to Zenhub

* version bump w/changelog (Cog-Creators#3403)

* fixup docs (Cog-Creators#3404)

* Update changelog_3_2_0.rst (Cog-Creators#3405)

* dev bump (Cog-Creators#3406)

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
Co-authored-by: Draper <27962761+Drapersniper@users.noreply.github.com>
Co-authored-by: Michael H <michael@michaelhall.tech>
Co-authored-by: Flame442 <34169552+Flame442@users.noreply.github.com>
Co-authored-by: Dav <57032623+Dav-Git@users.noreply.github.com>
Co-authored-by: Redjumpman <Redjumpman@users.noreply.github.com>
Co-authored-by: Stonedestroyer <1307729+Stonedestroyer@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.