From 0efb3ad20a75efc06b8d0d18e09edc421d5025ce Mon Sep 17 00:00:00 2001 From: test Date: Mon, 13 May 2024 09:15:54 +1000 Subject: [PATCH] Add to mail commands too --- .../commands/manager/v2/impl/pw/commands/AdminCommands.java | 3 +++ .../commands/manager/v2/impl/pw/commands/IACommands.java | 4 +++- .../manager/v2/impl/pw/commands/UnsortedCommands.java | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/commands/AdminCommands.java b/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/commands/AdminCommands.java index 62ccfb9c..0c4f8f8f 100644 --- a/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/commands/AdminCommands.java +++ b/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/commands/AdminCommands.java @@ -657,6 +657,9 @@ public String announce(@Me GuildDB db, @Me Guild guild, @Me JSONObject command, ApiKeyPool keys = (sendMail || sendDM) ? db.getMailKey() : null; if ((sendMail || sendDM) && keys == null) throw new IllegalArgumentException("No API_KEY set, please use " + GuildKey.API_KEY.getCommandMention() + ""); Set aaIds = db.getAllianceIds(); + if (sendMail || sendDM) { + GPTUtil.checkThrowModeration(announcement + "\n" + replacements); + } List errors = new ArrayList<>(); Collection nations = sendTo.getNations(); diff --git a/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/commands/IACommands.java b/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/commands/IACommands.java index 5c25d4ae..ec65fb1e 100644 --- a/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/commands/IACommands.java +++ b/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/commands/IACommands.java @@ -1676,7 +1676,9 @@ public String mailCommandOutput(NationPlaceholders placeholders, ValueStore stor sheet = SpreadSheet.create(db, SheetKey.MAIL_RESPONSES_SHEET); } if (body != null) { - GPTUtil.checkThrowModeration(body); + GPTUtil.checkThrowModeration(body + "\n" + command); + } else { + GPTUtil.checkThrowModeration(command); } List header = new ArrayList<>(Arrays.asList( diff --git a/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/commands/UnsortedCommands.java b/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/commands/UnsortedCommands.java index afafbc26..d53a2db3 100644 --- a/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/commands/UnsortedCommands.java +++ b/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/commands/UnsortedCommands.java @@ -52,6 +52,7 @@ import link.locutus.discord.db.entities.WarParser; import link.locutus.discord.db.guild.GuildKey; import link.locutus.discord.db.guild.SheetKey; +import link.locutus.discord.gpt.GPTUtil; import link.locutus.discord.pnw.AllianceList; import link.locutus.discord.pnw.NationList; import link.locutus.discord.pnw.NationOrAlliance; @@ -2095,6 +2096,9 @@ public String sendInvite(@Me GuildDB db, if (!member.hasPermission(Permission.CREATE_INSTANT_INVITE) && !Roles.ADMIN.has(author, inviteTo) && !Roles.INTERNAL_AFFAIRS.has(author, inviteTo)) { throw new IllegalArgumentException("You do not have permission to create invites in " + inviteTo); } + if (message != null) { + GPTUtil.checkThrowModeration(message); + } // dm user instructions find_announcement ApiKeyPool keys = (sendMail || sendDM) ? db.getMailKey() : null;