Skip to content

Commit

Permalink
Add to mail commands too
Browse files Browse the repository at this point in the history
  • Loading branch information
xdnw committed May 12, 2024
1 parent 9aee4a2 commit 0efb3ad
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Integer> aaIds = db.getAllianceIds();
if (sendMail || sendDM) {
GPTUtil.checkThrowModeration(announcement + "\n" + replacements);
}

List<String> errors = new ArrayList<>();
Collection<DBNation> nations = sendTo.getNations();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> header = new ArrayList<>(Arrays.asList(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0efb3ad

Please sign in to comment.