Skip to content

Commit 738278e

Browse files
committed
Fix custom pings not working
1 parent 6a7ca49 commit 738278e

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

relauncher

Submodule relauncher updated 22 files

src/commander/java/com/mcmoddev/mmdbot/commander/custompings/CustomPing.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
public record CustomPing(Pattern pattern, String text) implements Predicate<Message> {
2929
@Override
3030
public boolean test(final Message message) {
31-
return pattern.asMatchPredicate().test(message.getContentRaw());
31+
return pattern.matcher(message.getContentRaw()).find();
3232
}
3333
}

src/commander/java/com/mcmoddev/mmdbot/commander/eventlistener/FilePreviewListener.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@
3838

3939
public class FilePreviewListener implements EventListener {
4040

41-
public static final List<String> BLACKLISTED_EXTENSIONS = List.of(
42-
"png", "jpeg", "jpg", "jpe", "jif", "jfif", "jfi", "jp2",
43-
"tiff", "tif", "mp4", "avi", "mp3", "wav", "gif", "webp", "psd", "bpm",
44-
"mov", "ogg", "webm"
41+
public static final List<String> WHITELISTED_EXTENSIONS = List.of(
42+
"txt", "log", "java", "json", "groovy", "js",
43+
"cpp", "c", "gradle"
4544
);
4645

4746
public static final Emoji DISMISS_EMOJI = Emoji.fromMarkdown("\uD83D\uDEAE️");
@@ -61,7 +60,7 @@ public void onEvent(@NotNull final GenericEvent gE) {
6160
final var attach = attachments.get(i);
6261
if (attach.getFileExtension() == null)
6362
continue;
64-
if (!BLACKLISTED_EXTENSIONS.contains(attach.getFileExtension().toLowerCase(Locale.ROOT))) {
63+
if (WHITELISTED_EXTENSIONS.contains(attach.getFileExtension().toLowerCase(Locale.ROOT))) {
6564
final var url = URL + attach.getUrl();
6665
messageBuilder
6766
.append('`')

0 commit comments

Comments
 (0)