feat: Add support for Guild Incident Actions and Incidents Data parsing#2955
feat: Add support for Guild Incident Actions and Incidents Data parsing#2955Lulalaby merged 17 commits intoPycord-Development:masterfrom
Conversation
|
Thanks for opening this pull request! This pull request can be checked-out with: git fetch origin pull/2955/head:pr-2955
git checkout pr-2955This pull request can be installed with: pip install git+https://github.com/Pycord-Development/pycord@refs/pull/2955/head |
There was a problem hiding this comment.
Pull Request Overview
This PR adds comprehensive support for Discord's Guild Incident Actions API, enabling automated moderation features for guilds experiencing spam or raid incidents.
- Introduces
IncidentsDatamodel to represent guild incident states with timestamp fields for disabled invites/DMs and detected incidents - Adds
modify_incident_actionsmethod to the Guild class for programmatically managing incident restrictions - Implements HTTP endpoint integration for the
/guilds/{guild_id}/incident-actionsAPI route
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| discord/types/guild.py | Adds TypedDict definitions for IncidentsData and ModifyIncidents payloads |
| discord/incidents.py | New module containing IncidentsData class with datetime parsing and serialization |
| discord/http.py | Implements HTTP client method for modify_guild_incident_actions API endpoint |
| discord/guild.py | Integrates incidents_data attribute and modify_incident_actions method into Guild class |
| discord/init.py | Exports incidents module in package imports |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Soheab <33902984+Soheab@users.noreply.github.com> Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Soheab <33902984+Soheab@users.noreply.github.com> Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
|
@Lumabots missing copyright on |
I'll make a pr in a bit |
|
oop |
…ng (Pycord-Development#2955) * feat: add incident management functionality to guilds * fix: remove deprecated type checking configuration for basedpyright * style(pre-commit): auto fixes from pre-commit.com hooks * fix: rename incidents attribute to incidents_data to follow api * style(pre-commit): auto fixes from pre-commit.com hooks * Update discord/http.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com> * Update discord/guild.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com> * Update discord/incidents.py Co-authored-by: Soheab <33902984+Soheab@users.noreply.github.com> Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com> * refactor(incidents): simplify datetime parsing using parse_time utility * removal of guild * style(pre-commit): auto fixes from pre-commit.com hooks * Update discord/guild.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com> * fix(incidents): require data parameter in IncidentsData constructor * fix(guild): rename incidents attribute to incidents_data for clarity * Update guild.py Co-authored-by: Soheab <33902984+Soheab@users.noreply.github.com> Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com> --------- Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Soheab <33902984+Soheab@users.noreply.github.com> (cherry picked from commit 0ccf2f1)
Summary
This PR introduces full support for Discord’s Guild Incident Actions API and Incidents Data Object as defined in the Discord API documentation.
Key Features
• Implemented IncidentsData model to represent the guild’s current incident state:
• invites_disabled_until
• dms_disabled_until
• dm_spam_detected_at
• raid_detected_at
• Added ModifyIncidentsPayload type for modifying incident restrictions via REST.
Notes
• The incidents_data field may be omitted or null for guilds without active incidents.
• This update lays the groundwork for future automation or moderation features (e.g., automated incident reporting, DM lockdowns).
Example Usage
Information
examples, ...).
Checklist
type: ignorecomments were used, a comment is also left explaining why.