Search code examples
discorddiscord.js

Accesing Security Actions


I was wondering wether there is currently a way to acces the Security actions for a Guild via a bot, preferably through discordjs. I did not find any mention in the documentation though. Is there any way to change them?

Screenshot of the Discord-Security-Actions Panel

The reason why I want to access them is to permanently pause DMs on a Guild, instead of just the 24 hour of blocking provided by Discord.


Solution

  • The API for Security Actions has not yet been published on Discord's API docs. You can find the documentation for the endpoint here:


    Modify Guild Incident Actions

    PUT /guilds/{guild.id}/incident-actions

    Modifies the incident actions of the guild. Returns a 200 with the Incidents Data object for the guild. Requires the MANAGE_GUILD permission.


    This API has been added to discord.js in PR #10727 and is expected to release in discord.js v15. If you need this feature ASAP, you can install the main or feat/incident-actions. Then, you can use Guild.setIncidentActions and have a cron job push the dmsDisabledUntil 24 hours forward every day.