One guild setting as an anti-scam control
New members of a crypto-adjacent Discord get DMed within minutes by someone pretending to be support, and the server's moderation never sees it because it does not happen in the server. Turn member-to-member DMs off, through the API.
Discord has a guild-level setting for this. Applying it through the API rather than the UI matters when you run several servers, or want the setting under version control rather than in someone’s memory. It needs administrator scope for one setting, which is more permission than the job requires.
The cost is real. It also stops the legitimate private conversations that are part of why people join a community. For a large public server where most DMs between strangers are hostile, the trade is clearly worth it. For a small one it probably is not, and the honest framing is that this works because it is blunt.
It closes one door rather than ending the problem, attackers move to friend requests, adjacent servers, or off-platform.
no-dm-discord is the same code under an earlier name.