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: add on_audit_log_entry event #1873

Conversation

EmmmaTech
Copy link
Contributor

Summary

This PR implements an on_audit_log_entry event. Closes #1872.

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.

@EmmmaTech EmmmaTech requested a review from a team as a code owner January 13, 2023 00:52
@JustaSqu1d JustaSqu1d added the feature Implements a feature label Jan 13, 2023
@JustaSqu1d JustaSqu1d added the hold: documentation This pull request is missing documentation label Jan 13, 2023
@JustaSqu1d JustaSqu1d added hold: documentation This pull request is missing documentation and removed hold: documentation This pull request is missing documentation labels Jan 13, 2023
@Lulalaby Lulalaby self-requested a review January 13, 2023 00:55
@Lulalaby Lulalaby added the documentation Improvements or additions to documentation label Jan 13, 2023
@Lulalaby Lulalaby added this to the v2.4 milestone Jan 13, 2023
@JustaSqu1d JustaSqu1d added the status: in progress Work in Progess label Jan 13, 2023
@codecov
Copy link

codecov bot commented Jan 13, 2023

Codecov Report

Merging #1873 (597d5c9) into master (3b762f9) will decrease coverage by 0.12%.
The diff coverage is 50.00%.

❗ Current head 597d5c9 differs from pull request most recent head 01b7fe6. Consider uploading reports for the commit 01b7fe6 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1873      +/-   ##
==========================================
- Coverage   33.38%   33.27%   -0.12%     
==========================================
  Files          97       96       -1     
  Lines       18815    18706     -109     
==========================================
- Hits         6282     6225      -57     
+ Misses      12533    12481      -52     
Flag Coverage Δ
macos-latest-3.10 33.26% <50.00%> (-0.12%) ⬇️
macos-latest-3.11 33.26% <50.00%> (-0.12%) ⬇️
macos-latest-3.8 33.27% <50.00%> (-0.12%) ⬇️
macos-latest-3.9 33.27% <50.00%> (-0.12%) ⬇️
ubuntu-latest-3.10 33.26% <50.00%> (-0.12%) ⬇️
ubuntu-latest-3.11 33.26% <50.00%> (-0.12%) ⬇️
ubuntu-latest-3.8 33.27% <50.00%> (-0.12%) ⬇️
ubuntu-latest-3.9 33.27% <50.00%> (-0.12%) ⬇️
windows-latest-3.10 33.26% <50.00%> (-0.12%) ⬇️
windows-latest-3.11 33.26% <50.00%> (-0.12%) ⬇️
windows-latest-3.8 33.27% <50.00%> (-0.12%) ⬇️
windows-latest-3.9 33.27% <50.00%> (-0.12%) ⬇️

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

Impacted Files Coverage Δ
discord/state.py 14.89% <25.00%> (+0.19%) ⬆️
discord/flags.py 76.09% <100.00%> (ø)
discord/raw_models.py 28.10% <0.00%> (-2.19%) ⬇️
discord/enums.py 79.61% <0.00%> (-0.36%) ⬇️
discord/client.py 28.79% <0.00%> (-0.16%) ⬇️
discord/http.py 22.98% <0.00%> (-0.08%) ⬇️
discord/abc.py 22.33% <0.00%> (ø)
discord/cog.py 34.92% <0.00%> (ø)
discord/guild.py 23.77% <0.00%> (ø)
... and 14 more

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 3b762f9...01b7fe6. Read the comment docs.

def bans(self):
""":class:`bool`: Alias of :attr:`.moderation`.

.. versionchanged:: fill in
Copy link
Member

Choose a reason for hiding this comment

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

2.4 most likely

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought I replaced that placeholder with 2.4...

@@ -706,18 +706,28 @@ def members(self):
return 1 << 1

@flag_value
def bans(self):
def moderation(self):
""":class:`bool`: Whether guild ban related events are enabled.
Copy link
Member

Choose a reason for hiding this comment

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

Change description

@@ -1320,6 +1321,15 @@ def parse_guild_delete(self, data) -> None:
self._remove_guild(guild)
self.dispatch("guild_remove", guild)

def parse_guild_audit_log_entry_create(self, data) -> None:
guild = self._get_guild(int(data["guild_id"]))
user = self.get_user(data["user_id"])
Copy link
Member

@plun1331 plun1331 Jan 13, 2023

Choose a reason for hiding this comment

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

Potentially make a raw event as it depends on user cache state

This comment was marked as outdated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nevermind, I get it now.

@UP929312
Copy link
Contributor

Is this still being worked on?

@EmmmaTech
Copy link
Contributor Author

Is this still being worked on?

Sorry, I thought I could delay working on this PR for later without problems.

@Lulalaby Lulalaby modified the milestones: v2.4, v2.5 Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation feature Implements a feature hold: documentation This pull request is missing documentation status: in progress Work in Progess
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add new gateway event: GUILD_AUDIT_LOG_ENTRY_CREATE
5 participants