From 00e30bd073f876e5a0bb5936d4698d31089a1ab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beatrice=20Dellac=C3=A0?= Date: Fri, 26 Aug 2022 00:20:29 +0200 Subject: [PATCH] Add support for attachments in message logger --- .../wtf/beatrice/hidekobot/listeners/MessageLogger.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/wtf/beatrice/hidekobot/listeners/MessageLogger.java b/src/main/java/wtf/beatrice/hidekobot/listeners/MessageLogger.java index f0c6cc9..f393f18 100644 --- a/src/main/java/wtf/beatrice/hidekobot/listeners/MessageLogger.java +++ b/src/main/java/wtf/beatrice/hidekobot/listeners/MessageLogger.java @@ -1,5 +1,6 @@ package wtf.beatrice.hidekobot.listeners; +import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.entities.PrivateChannel; import net.dv8tion.jda.api.entities.TextChannel; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; @@ -43,5 +44,13 @@ public class MessageLogger extends ListenerAdapter .replace("%message%", message); logger.log(toLog); + + if(!event.getMessage().getAttachments().isEmpty()) + { + for(Message.Attachment atch : event.getMessage().getAttachments()) + { + logger.log(atch.getUrl()); + } + } } }