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

[Perms v2] Additional implementations #1303

Merged
merged 12 commits into from
May 3, 2022

Conversation

plun1331
Copy link
Member

@plun1331 plun1331 commented Apr 28, 2022

Summary

Targets the permissions-v2 branch

  • Implements the audit log event
  • Removes permission v1 code
  • New audit log change fields
  • Implements HTTP endpoints & removes permissions v1 endpoint

Things that still need to be done:

  • Some sort of caching for command permissions (may be problematic to implement into discord.Client)
  • Implement the APPLICATION_COMMAND_PERMISSIONS_UPDATE gateway event (same issue as above)

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, typehinting, examples, ...)

@codecov
Copy link

codecov bot commented May 2, 2022

Codecov Report

Merging #1303 (f7111c6) into permissions-v2 (28fb2f6) will increase coverage by 0.06%.
The diff coverage is 45.45%.

Impacted file tree graph

@@                Coverage Diff                 @@
##           permissions-v2    #1303      +/-   ##
==================================================
+ Coverage           33.46%   33.52%   +0.06%     
==================================================
  Files                  93       93              
  Lines               17575    17550      -25     
==================================================
+ Hits                 5881     5884       +3     
+ Misses              11694    11666      -28     
Flag Coverage Δ
pytest 33.52% <45.45%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
discord/audit_logs.py 28.57% <ø> (ø)
discord/bot.py 18.87% <ø> (+1.30%) ⬆️
discord/enums.py 78.19% <33.33%> (-0.27%) ⬇️
discord/http.py 23.41% <40.00%> (+0.03%) ⬆️
discord/state.py 14.56% <50.00%> (+0.06%) ⬆️
discord/types/interactions.py 99.28% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 28fb2f6...f7111c6. Read the comment docs.

@plun1331
Copy link
Member Author

plun1331 commented May 2, 2022

not going to implement gateway events in this PR for now, otherwise it's ready

@plun1331 plun1331 marked this pull request as ready for review May 2, 2022 21:19
@plun1331 plun1331 added priority: high High Priority feature Implements a feature labels May 2, 2022
@plun1331 plun1331 requested review from Dorukyum, krittick and BobDotCom and removed request for Dorukyum, krittick and BobDotCom May 2, 2022 21:21
@plun1331 plun1331 added the status: awaiting review Awaiting review from a maintainer label May 2, 2022
@Lulalaby Lulalaby merged commit bcfd8ce into Pycord-Development:permissions-v2 May 3, 2022
krittick added a commit that referenced this pull request May 5, 2022
* Remove v1 from application commands

* Remove permissions v1 from documentation

* Add v2 attributes to commands

* Fix permissions for groups

* Use v2 in as_dict methods

* Add new permission decorator

* Add missing return

* Allow both kwargs and decorators for permissions

* Add guild_only decorator

* Allow decorating a command

* Remove permissions v1 from docs

* Fix to_check in get_desynced_commands

* merge master into permissions-v2

* Rename has_permissions to default_permissions

* Document command permissions

* Fix command permissions doc note

* Remove note

* Rename dm_permission to guild_only for parity

* Fix imports

* Fix kwarg name

* Move permission attributes to parent class

* Fix guild_only decorator

* [Perms v2] Additional implementations (#1303)

* Update discord/commands/core.py

Co-authored-by: Jay Turner <[email protected]>

* Reduce need for Permissions TypeVar

* Update api.rst

* merge permissionsv2 into master branch copy

* apply code style fixes

* apply code style fixes

Co-authored-by: Dorukyum <[email protected]>
Co-authored-by: Dorukyum <[email protected]>
Co-authored-by: BobDotCom <[email protected]>
Co-authored-by: Lala Sabathil <[email protected]>
Co-authored-by: plun1331 <[email protected]>
Co-authored-by: Jay Turner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Implements a feature priority: high High Priority status: awaiting review Awaiting review from a maintainer
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

3 participants