Skip to content

Commit

Permalink
feat: Add Guild.delete_auto_moderation_rule (Pycord-Development#2153)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Signed-off-by: Marc13 <[email protected]>

* Update guild.py

* Apply suggestions from code review

Signed-off-by: Lala Sabathil <[email protected]>

* Update discord/guild.py

Signed-off-by: Lala Sabathil <[email protected]>

* Apply suggestions from code review

Signed-off-by: Lala Sabathil <[email protected]>

* Apply suggestions from code review

Signed-off-by: Lala Sabathil <[email protected]>

* Apply suggestions from reviews

* Apply suggestions from code review

---------

Signed-off-by: Marc13 <[email protected]>
Signed-off-by: Lala Sabathil <[email protected]>
Signed-off-by: Lala Sabathil <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: JustaSqu1d <[email protected]>
Co-authored-by: Lala Sabathil <[email protected]>
Co-authored-by: Lala Sabathil <[email protected]>
Co-authored-by: plun1331 <[email protected]>
  • Loading branch information
6 people authored Aug 29, 2023
1 parent a261176 commit a3bd2a0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
26 changes: 26 additions & 0 deletions discord/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit a3bd2a0

Please sign in to comment.