sort sniped messages

This commit is contained in:
Lee
2024-07-02 00:54:55 +01:00
parent 37c69597be
commit 1a69bce9dd
5 changed files with 8 additions and 6 deletions

View File

@ -57,6 +57,7 @@ public class MessageSnipeFeature extends Feature implements EventListener {
*/
public static SnipedMessage getDeletedMessage(BatGuild guild, String channelId) {
List<SnipedMessage> messages = snipedMessages.getOrDefault(guild, new ArrayList<>());
messages.sort(Comparator.comparing(SnipedMessage::getDeletedDate));
for (SnipedMessage message : messages) {
if (message.getDeletedDate() != null // Check if the message was deleted
&& message.getMessage().getChannel().getId().equals(channelId)) {