Add support for attachments in message logger
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Bea 2022-08-26 00:20:29 +02:00
parent 7d068892e2
commit 00e30bd073

View File

@ -1,5 +1,6 @@
package wtf.beatrice.hidekobot.listeners; 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.PrivateChannel;
import net.dv8tion.jda.api.entities.TextChannel; import net.dv8tion.jda.api.entities.TextChannel;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
@ -43,5 +44,13 @@ public class MessageLogger extends ListenerAdapter
.replace("%message%", message); .replace("%message%", message);
logger.log(toLog); logger.log(toLog);
if(!event.getMessage().getAttachments().isEmpty())
{
for(Message.Attachment atch : event.getMessage().getAttachments())
{
logger.log(atch.getUrl());
}
}
} }
} }