Skip to content

Commit 009f61f

Browse files
authored
chore: update channel used in ThisIsScamCommand to modmail instead of mod-audit-logs (#1509)
* chore: update channel used in `ThisIsScamCommand` to `modmail` instead of `mod-audit-logs` * chore: rename var to match modmail * chore: rename method name to match modmail
1 parent 9161868 commit 009f61f

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

application/src/main/java/org/togetherjava/tjbot/features/moderation/ThisIsScamCommand.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public final class ThisIsScamCommand extends BotCommandAdapter implements Messag
6666

6767
private final Config config;
6868
private final ModerationActionsStore actionsStore;
69-
private final Predicate<String> isModAuditLogChannel;
69+
private final Predicate<String> isModMailChannel;
7070

7171
private final Cache<Long, Instant> reportedMessageToTimestamp =
7272
Caffeine.newBuilder().maximumSize(10_000).expireAfterWrite(Duration.ofDays(1)).build();
@@ -86,8 +86,7 @@ public ThisIsScamCommand(Config config, ModerationActionsStore actionsStore) {
8686

8787
this.config = Objects.requireNonNull(config);
8888
this.actionsStore = Objects.requireNonNull(actionsStore);
89-
isModAuditLogChannel =
90-
Pattern.compile(config.getModAuditLogChannelPattern()).asMatchPredicate();
89+
isModMailChannel = Pattern.compile(config.getModMailChannelPattern()).asMatchPredicate();
9190
}
9291

9392
@Override
@@ -99,7 +98,7 @@ public void onMessageContext(MessageContextInteractionEvent event) {
9998
return;
10099
}
101100

102-
Optional<TextChannel> modAuditLog = findModAuditLogChannel(event);
101+
Optional<TextChannel> modAuditLog = findModMailChannel(event);
103102
if (modAuditLog.isEmpty()) {
104103
event.reply(FAILED_MESSAGE).setEphemeral(true).queue();
105104
return;
@@ -150,16 +149,15 @@ private boolean handleWasAlreadyReportedMessage(MessageContextInteractionEvent e
150149
return false;
151150
}
152151

153-
private Optional<TextChannel> findModAuditLogChannel(MessageContextInteractionEvent event) {
152+
private Optional<TextChannel> findModMailChannel(MessageContextInteractionEvent event) {
154153
Guild guild = Objects.requireNonNull(event.getGuild());
155-
Optional<TextChannel> modAuditLogChannel =
156-
Guilds.findTextChannel(guild, isModAuditLogChannel);
157-
if (modAuditLogChannel.isEmpty()) {
154+
Optional<TextChannel> modMailChannel = Guilds.findTextChannel(guild, isModMailChannel);
155+
if (modMailChannel.isEmpty()) {
158156
logger.warn(
159157
"Cannot find the designated mod audit log channel in guild '{}' with the pattern '{}'",
160158
guild.getId(), config.getModAuditLogChannelPattern());
161159
}
162-
return modAuditLogChannel;
160+
return modMailChannel;
163161
}
164162

165163
private MessageCreateAction reportToMods(Message message, TextChannel auditChannel) {

0 commit comments

Comments
 (0)