Package org.javacord.api.entity.message
Interface MessageSet
-
- All Superinterfaces:
java.util.Collection<Message>,java.lang.Iterable<Message>,java.util.NavigableSet<Message>,java.util.Set<Message>,java.util.SortedSet<Message>
public interface MessageSet extends java.util.NavigableSet<Message>
This class represents an unmodifiable set of messages that is always sorted from oldest to newest according to the natural ordering ofMessages.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.util.concurrent.CompletableFuture<java.lang.Void>deleteAll()Deletes all messages in this message set at once.default java.util.Optional<Message>getNewestMessage()Gets the newest message in the history.default java.util.Optional<Message>getOldestMessage()Gets the oldest message in the history.MessageSetheadSet(Message toElement)MessageSetheadSet(Message toElement, boolean inclusive)MessageSetsubSet(Message fromElement, boolean fromInclusive, Message toElement, boolean toInclusive)MessageSetsubSet(Message fromElement, Message toElement)MessageSettailSet(Message fromElement)MessageSettailSet(Message fromElement, boolean inclusive)-
Methods inherited from interface java.util.NavigableSet
ceiling, descendingIterator, descendingSet, floor, higher, iterator, lower, pollFirst, pollLast
-
-
-
-
Method Detail
-
getOldestMessage
default java.util.Optional<Message> getOldestMessage()
Gets the oldest message in the history.- Returns:
- The oldest message in the history.
-
getNewestMessage
default java.util.Optional<Message> getNewestMessage()
Gets the newest message in the history.- Returns:
- The newest message in the history.
-
deleteAll
default java.util.concurrent.CompletableFuture<java.lang.Void> deleteAll()
Deletes all messages in this message set at once. This method does not have a size or age restriction. Messages younger than two weeks are sent in batches of 100 messages to the bulk delete API, older messages are deleted with individual delete requests.- Returns:
- A future to tell us if the deletion was successful.
-
subSet
MessageSet subSet(Message fromElement, boolean fromInclusive, Message toElement, boolean toInclusive)
- Specified by:
subSetin interfacejava.util.NavigableSet<Message>
-
subSet
MessageSet subSet(Message fromElement, Message toElement)
-
headSet
MessageSet headSet(Message toElement, boolean inclusive)
- Specified by:
headSetin interfacejava.util.NavigableSet<Message>
-
headSet
MessageSet headSet(Message toElement)
-
tailSet
MessageSet tailSet(Message fromElement)
-
tailSet
MessageSet tailSet(Message fromElement, boolean inclusive)
- Specified by:
tailSetin interfacejava.util.NavigableSet<Message>
-
-