feat(moderation): add the unmute and unban commands

A sanction could be applied but never lifted from Discord, so undoing a
mistake meant leaving the bot for the server settings. Both lifts are
recorded next to the sanctions they lift, which means widening the
moderation history CHECK constraint through a table rebuild.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
BlackAngelTV committed 2026-09-25 20:11:00 +02:00
1 parent b8be549fda
commit 9f8ac0d29e
8 files changed
+162 -2

No files matched your search

@@ -100,9 +100,11 @@ export async function sendModerationLog(
* Sends the private notice to the sanctioned member, when the server wants one
* (M8-T07). Never throws: plenty of accounts refuse direct messages, and that
* must not turn a successful sanction into an error.
* @param guildId Server the sanction belongs to. A lifted ban targets someone
* who has left the server, so a plain `User` is accepted with an explicit id.
*/
export async function notifyTarget(member, payload) {
if (!readSetting('moderation.dmTarget', member.guild.id)) return false;
export async function notifyTarget(member, payload, guildId = member.guild?.id) {
if (!readSetting('moderation.dmTarget', guildId)) return false;
return member
.send(payload)
.then(() => true)