From a3bd2a04fbd7ac0cec5a119cc9b360965aaaab8e Mon Sep 17 00:00:00 2001 From: Marc13 <83296140+llamaair@users.noreply.github.com> Date: Tue, 29 Aug 2023 03:37:00 +0200 Subject: [PATCH] feat: Add `Guild.delete_auto_moderation_rule` (#2153) * Update guild.py * Update guild.py * style(pre-commit): auto fixes from pre-commit.com hooks * Update CHANGELOG.md * Update discord/guild.py Co-authored-by: JustaSqu1d <89910983+JustaSqu1d@users.noreply.github.com> Signed-off-by: Marc13 <83296140+llamaair@users.noreply.github.com> * Update guild.py * Apply suggestions from code review Signed-off-by: Lala Sabathil * Update discord/guild.py Signed-off-by: Lala Sabathil * Apply suggestions from code review Signed-off-by: Lala Sabathil * Apply suggestions from code review Signed-off-by: Lala Sabathil * Apply suggestions from reviews * Apply suggestions from code review --------- Signed-off-by: Marc13 <83296140+llamaair@users.noreply.github.com> Signed-off-by: Lala Sabathil Signed-off-by: Lala Sabathil Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: JustaSqu1d <89910983+JustaSqu1d@users.noreply.github.com> Co-authored-by: Lala Sabathil Co-authored-by: Lala Sabathil Co-authored-by: plun1331 --- CHANGELOG.md | 2 ++ discord/guild.py | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45f8d1e2fc..d0fca146d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -76,6 +76,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2194](https://github.com/Pycord-Development/pycord/pull/2194)) - Added support for custom bot status. ([#2206](https://github.com/Pycord-Development/pycord/pull/2206)) +- Added function `Guild.delete_auto_moderation_rule`. + ([#2153](https://github.com/Pycord-Development/pycord/pull/2153)) ### Changed diff --git a/discord/guild.py b/discord/guild.py index 2bd77b2dd5..5d74590dca 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -3816,3 +3816,29 @@ async def create_auto_moderation_rule( self.id, payload, reason=reason ) return AutoModRule(state=self._state, data=data) + + async def delete_auto_moderation_rule( + self, + id: int, + *, + reason: str | None = None, + ) -> None: + """ + Deletes an auto moderation rule. + + Parameters + ---------- + id: :class:`int` + The ID of the auto moderation rule. + reason: Optional[:class:`str`] + The reason for deleting the rule. Shows up in the audit log. + + Raises + ------ + HTTPException + Deleting the auto moderation rule failed. + Forbidden + You do not have the Manage Guild permission. + """ + + await self._state.http.delete_auto_moderation_rule(self.id, id, reason=reason)