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

feat: Implement audit log events #1932

Merged
merged 16 commits into from
Feb 22, 2023

Conversation

NeloBlivion
Copy link
Member

@NeloBlivion NeloBlivion commented Feb 18, 2023

Summary

Continuation of #1873, implementing changes as per discord/discord-api-docs#5849:

  • Intents.bans is now an alias of Intents.moderation
  • Implements on_audit_log_entry
  • Implements on_raw_audit_log_entry and its respective payload.

Closes #1872.

This PR is functionally complete, however I'm not entirely sure on the raw payload structure; currently the only converted objects are:

  • guild, as it'll only fire for cached guilds
  • action_type as Enums are easy enough to deal with

Is it worth trying to convert anything else? It's kind of odd to work with the original data but both extra (options) and changes are fairly cache reliant and can't efficiently be done with the current methods, though changes could work if you force everything to be an Object. That being said, it's still a Raw event so working with raw data should be expected.

Information

  • 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, ...).

Checklist

  • I have searched the open pull requests for duplicates.
  • 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.

@NeloBlivion NeloBlivion requested a review from a team as a code owner February 18, 2023 23:18
@JustaSqu1d JustaSqu1d added priority: high High Priority feature Implements a feature python API reflection Discord API isn't correctly reflected labels Feb 18, 2023
@codecov
Copy link

codecov bot commented Feb 18, 2023

Codecov Report

Merging #1932 (5ce2117) into master (b5fd638) will decrease coverage by 0.02%.
The diff coverage is 31.25%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1932      +/-   ##
==========================================
- Coverage   33.38%   33.37%   -0.02%     
==========================================
  Files          97       97              
  Lines       18815    18845      +30     
==========================================
+ Hits         6282     6290       +8     
- Misses      12533    12555      +22     
Flag Coverage Δ
macos-latest-3.10 33.36% <31.25%> (-0.02%) ⬇️
macos-latest-3.11 33.36% <31.25%> (-0.02%) ⬇️
macos-latest-3.8 33.37% <31.25%> (-0.02%) ⬇️
macos-latest-3.9 33.37% <31.25%> (-0.02%) ⬇️
ubuntu-latest-3.10 33.36% <31.25%> (-0.02%) ⬇️
ubuntu-latest-3.11 33.36% <31.25%> (-0.02%) ⬇️
ubuntu-latest-3.8 33.37% <31.25%> (-0.02%) ⬇️
ubuntu-latest-3.9 33.37% <31.25%> (-0.02%) ⬇️
windows-latest-3.10 33.36% <31.25%> (-0.02%) ⬇️
windows-latest-3.11 33.36% <31.25%> (-0.02%) ⬇️
windows-latest-3.8 33.37% <31.25%> (-0.02%) ⬇️
windows-latest-3.9 33.37% <31.25%> (-0.02%) ⬇️

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

Impacted Files Coverage Δ
discord/state.py 14.70% <14.28%> (-0.01%) ⬇️
discord/raw_models.py 29.78% <28.57%> (-0.50%) ⬇️
discord/flags.py 76.27% <100.00%> (+0.17%) ⬆️

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 b5fd638...5ce2117. Read the comment docs.

@NeloBlivion
Copy link
Member Author

FAQ text should be updated with the correct version number before releasing

Co-authored-by: plun1331 <49261529+plun1331@users.noreply.github.com>
Signed-off-by: UK <41271523+NeloBlivion@users.noreply.github.com>
@NeloBlivion
Copy link
Member Author

Regarding version numbers, it ultimately depends on the release because versionadded has always been limited to the minor version (i.e. 2.x) so even if it was e.g. 2.4.1 we'd still use 2.4.
Though tbf, the original issue #1872 was moved to 2.5 so it may be necessary to change it to that.

@Lulalaby Lulalaby added this to the v2.5 milestone Feb 19, 2023
NeloBlivion and others added 7 commits February 19, 2023 05:30
Co-authored-by: Lala Sabathil <aiko@aitsys.dev>
Signed-off-by: UK <41271523+NeloBlivion@users.noreply.github.com>
Co-authored-by: Lala Sabathil <aiko@aitsys.dev>
Signed-off-by: UK <41271523+NeloBlivion@users.noreply.github.com>
Co-authored-by: Lala Sabathil <aiko@aitsys.dev>
Signed-off-by: UK <41271523+NeloBlivion@users.noreply.github.com>
Co-authored-by: Lala Sabathil <aiko@aitsys.dev>
Signed-off-by: UK <41271523+NeloBlivion@users.noreply.github.com>
Co-authored-by: Lala Sabathil <aiko@aitsys.dev>
Signed-off-by: UK <41271523+NeloBlivion@users.noreply.github.com>
@BobDotCom BobDotCom enabled auto-merge (squash) February 22, 2023 15:29
@BobDotCom BobDotCom merged commit 8a91137 into Pycord-Development:master Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API reflection Discord API isn't correctly reflected feature Implements a feature priority: high High Priority
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add new gateway event: GUILD_AUDIT_LOG_ENTRY_CREATE
5 participants