Skip to content

Commit e5be72b

Browse files
committed
Enhanced the experience.
1 parent 03150bd commit e5be72b

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

.idea/gradle.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/java/org/mangorage/mangobotgithub/core/PasteRequestModule.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ public final class PasteRequestModule {
5050
"gnomebot.dev"
5151
);
5252

53+
private static final List<String> VALID_CONTENT_TYPES = List.of(
54+
"application/json",
55+
"text"
56+
);
57+
5358
private static final Emoji CREATE_GISTS = Emoji.fromUnicode("\uD83D\uDCCB");
5459
private static final Emoji ANALYZE = Emoji.fromUnicode("\uD83E\uDDD0");
5560

@@ -240,8 +245,15 @@ public static void onMessage(DiscordEvent<MessageReceivedEvent> event) {
240245
}
241246

242247
if (!message.getAttachments().isEmpty()) {
243-
message.addReaction(CREATE_GISTS).queue();
244-
analyze = true;
248+
chk: for (Message.Attachment attachment : message.getAttachments()) {
249+
for (String validContentType : VALID_CONTENT_TYPES) {
250+
if (attachment.getContentType().contains(validContentType)) {
251+
message.addReaction(CREATE_GISTS).queue();
252+
analyze = true;
253+
break chk;
254+
}
255+
}
256+
}
245257
}
246258

247259
if (analyze)

0 commit comments

Comments
 (0)