Interface TextChannel

    • Method Detail

      • type

        CompletableFuture<Void> type​()
        Displays the "xyz is typing..." message. The message automatically disappears after 10 seconds or after sending a message. No ratelimit retries are done at all. If the ratelimit is reached already, then the returned future will complete exceptionally right on the first try with a RatelimitException.
        Returns:
        A future to tell us if the action was successful.
        See Also:
        typeContinuously(), typeContinuously(Consumer)
      • typeContinuously

        default NonThrowingAutoCloseable typeContinuously​()
        Displays the "xyz is typing..." message continuously, starting immediately. The message is continuously displayed if not quit using the returned AutoCloseable. Sending a message will make the message go away shortly, but it will return immediately if not cancelled using the AutoCloseable. This can be used in a try-with-resources block like try (NonThrowingAutoCloseable typingIndicator = textChannel.typeContinuously()) { /* do lengthy stuff */ } sendReply();.

        The typing indicator will immediately be shown. To delay the display of the first typing indicator, use typeContinuouslyAfter(long, TimeUnit). This can be useful if the task you do can be finished in very short time which could cause the typing indicator and the response message being sent at the same time and the typing indicator could be shown for 10 seconds even if the message was sent already.

        Any occurring exceptions including ratelimit exceptions are suppressed. If you want to handle exceptions, use typeContinuously(Consumer) or typeContinuouslyAfter(long, TimeUnit, Consumer).

        Returns:
        An auto-closable to stop sending the typing indicator.
        See Also:
        type(), typeContinuously(Consumer), typeContinuouslyAfter(long, TimeUnit), typeContinuouslyAfter(long, TimeUnit, Consumer)
      • typeContinuously

        default NonThrowingAutoCloseable typeContinuously​(Consumer<Throwable> exceptionHandler)
        Displays the "xyz is typing..." message continuously, starting immediately. The message is continuously displayed if not quit using the returned AutoCloseable. Sending a message will make the message go away shortly, but it will return immediately if not cancelled using the AutoCloseable. This can be used in a try-with-resources block like try (NonThrowingAutoCloseable typingIndicator = textChannel.typeContinuously(ExceptionLogger.getConsumer(RatelimitException.class))) { /* do lengthy stuff */ } sendReply();.

        The typing indicator will immediately be shown. To delay the display of the first typing indicator, use typeContinuouslyAfter(long, TimeUnit). This can be useful if the task you do can be finished in very short time which could cause the typing indicator and the response message being sent at the same time and the typing indicator could be shown for 10 seconds even if the message was sent already.

        Any occurring exceptions including ratelimit exceptions are given to the provided exceptionHandler or ignored if it is null.

        Parameters:
        exceptionHandler - The handler that exceptions are given to.
        Returns:
        An auto-closable to stop sending the typing indicator.
        See Also:
        type(), typeContinuously(), typeContinuouslyAfter(long, TimeUnit), typeContinuouslyAfter(long, TimeUnit, Consumer)
      • typeContinuouslyAfter

        default NonThrowingAutoCloseable typeContinuouslyAfter​(long delay,
                                                               TimeUnit timeUnit)
        Displays the "xyz is typing..." message continuously, starting delayed. The message is continuously displayed if not quit using the returned AutoCloseable. Sending a message will make the message go away shortly, but it will return immediately if not cancelled using the AutoCloseable. This can be used in a try-with-resources block like try (NonThrowingAutoCloseable typingIndicator = textChannel.typeContinuouslyAfter(500, TimeUnit.MILLISECONDS)) { /* do lengthy stuff */ } sendReply();.

        The typing indicator will be shown delayed. This can be useful if the task you do can be finished in very short time which could cause the typing indicator and the response message being sent at the same time and the typing indicator could be shown for 10 seconds even if the message was sent already. With the delay this is compensated, because if the returned AutoCloseable is closed before the delay is over, no typing indicator will be sent at all.

        Any occurring exceptions including ratelimit exceptions are suppressed. If you want to handle exceptions, use typeContinuously(Consumer) or typeContinuouslyAfter(long, TimeUnit, Consumer).

        Parameters:
        delay - The delay to wait until the first typing indicator is sent.
        timeUnit - The time unit of the delay value.
        Returns:
        An auto-closable to stop sending the typing indicator.
        See Also:
        type(), typeContinuously(), typeContinuously(Consumer), typeContinuouslyAfter(long, TimeUnit, Consumer)
      • typeContinuouslyAfter

        default NonThrowingAutoCloseable typeContinuouslyAfter​(long delay,
                                                               TimeUnit timeUnit,
                                                               Consumer<Throwable> exceptionHandler)
        Displays the "xyz is typing..." message continuously, starting delayed. The message is continuously displayed if not quit using the returned AutoCloseable. Sending a message will make the message go away shortly, but it will return immediately if not cancelled using the AutoCloseable. This can be used in a try-with-resources block like try (NonThrowingAutoCloseable typingIndicator = textChannel.typeContinuouslyAfter(500, TimeUnit.MILLISECONDS, ExceptionLogger.getConsumer(RatelimitException.class))) { /* do lengthy stuff */ } sendReply();.

        The typing indicator will be shown delayed. This can be useful if the task you do can be finished in very short time which could cause the typing indicator and the response message being sent at the same time and the typing indicator could be shown for 10 seconds even if the message was sent already. With the delay this is compensated, because if the returned AutoCloseable is closed before the delay is over, no typing indicator will be sent at all.

        Any occurring exceptions including ratelimit exceptions are given to the provided exceptionHandler or ignored if it is null.

        Parameters:
        exceptionHandler - The handler that exceptions are given to.
        delay - The delay to wait until the first typing indicator is sent.
        timeUnit - The time unit of the delay value.
        Returns:
        An auto-closable to stop sending the typing indicator.
        See Also:
        type(), typeContinuously(), typeContinuously(Consumer), typeContinuouslyAfter(long, TimeUnit)
      • bulkDelete

        default CompletableFuture<Void> bulkDelete​(Iterable<Message> messages)
        Deletes multiple messages at once. Any message given that is invalid will count towards the minimum and maximum message count (currently 2 and 100 respectively). Additionally, duplicated messages will only be counted once. If a message is older than 2 weeks, the method will fail.
        Parameters:
        messages - The messages to delete.
        Returns:
        A future to tell us if the deletion was successful.
      • bulkDelete

        CompletableFuture<Void> bulkDelete​(long... messageIds)
        Deletes multiple messages at once. Any message id given that do not exist or are invalid will count towards the minimum and maximum message count (currently 2 and 100 respectively). Additionally, duplicated ids will only be counted once. If a message is older than 2 weeks, the method will fail.
        Parameters:
        messageIds - The ids of the messages to delete.
        Returns:
        A future to tell us if the deletion was successful.
      • bulkDelete

        default CompletableFuture<Void> bulkDelete​(String... messageIds)
        Deletes multiple messages at once. Any message id given that do not exist or are invalid will count towards the minimum and maximum message count (currently 2 and 100 respectively). Additionally, duplicated ids will only be counted once. If a message is older than 2 weeks, the method will fail.
        Parameters:
        messageIds - The ids of the messages to delete.
        Returns:
        A future to tell us if the deletion was successful.
      • bulkDelete

        default CompletableFuture<Void> bulkDelete​(Message... messages)
        Deletes multiple messages at once. Any message given that is invalid will count towards the minimum and maximum message count (currently 2 and 100 respectively). Additionally, duplicated messages will only be counted once. If a message is older than 2 weeks, the method will fail.
        Parameters:
        messages - The messages to delete.
        Returns:
        A future to tell us if the deletion was successful.
      • deleteMessages

        default CompletableFuture<Void> deleteMessages​(Iterable<Message> messages)
        Deletes multiple messages 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.
        Parameters:
        messages - The messages to delete.
        Returns:
        A future to tell us if the deletion was successful.
      • deleteMessages

        default CompletableFuture<Void> deleteMessages​(long... messageIds)
        Deletes multiple messages 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.
        Parameters:
        messageIds - The ids of the messages to delete.
        Returns:
        A future to tell us if the deletion was successful.
      • deleteMessages

        default CompletableFuture<Void> deleteMessages​(String... messageIds)
        Deletes multiple messages 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.
        Parameters:
        messageIds - The ids of the messages to delete.
        Returns:
        A future to tell us if the deletion was successful.
      • deleteMessages

        default CompletableFuture<Void> deleteMessages​(Message... messages)
        Deletes multiple messages 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.
        Parameters:
        messages - The messages to delete.
        Returns:
        A future to tell us if the deletion was successful.
      • getMessageById

        CompletableFuture<Message> getMessageById​(long id)
        Gets a message by its id.
        Parameters:
        id - The id of the message.
        Returns:
        The message with the given id.
      • getMessageById

        default CompletableFuture<Message> getMessageById​(String id)
        Gets a message by its id.
        Parameters:
        id - The id of the message.
        Returns:
        The message with the given id.
      • getMessages

        CompletableFuture<MessageSet> getMessages​(int limit)
        Gets up to a given amount of messages in this channel from the newer end.
        Parameters:
        limit - The limit of messages to get.
        Returns:
        The messages.
        See Also:
        getMessagesAsStream()
      • getMessagesUntil

        CompletableFuture<MessageSet> getMessagesUntil​(Predicate<Message> condition)
        Gets messages in this channel from the newer end until one that meets the given condition is found. If no message matches the condition, an empty set is returned.
        Parameters:
        condition - The abort condition for when to stop retrieving messages.
        Returns:
        The messages.
        See Also:
        getMessagesAsStream()
      • getMessagesWhile

        CompletableFuture<MessageSet> getMessagesWhile​(Predicate<Message> condition)
        Gets messages in this channel from the newer end while they meet the given condition. If the first message does not match the condition, an empty set is returned.
        Parameters:
        condition - The condition that has to be met.
        Returns:
        The messages.
        See Also:
        getMessagesAsStream()
      • getMessagesAsStream

        Stream<Message> getMessagesAsStream​()
        Gets a stream of messages in this channel sorted from newest to oldest.

        The messages are retrieved in batches synchronously from Discord, so consider not using this method from a listener directly.

        Returns:
        The stream.
        See Also:
        getMessages(int)
      • getMessagesBefore

        CompletableFuture<MessageSet> getMessagesBefore​(int limit,
                                                        long before)
        Gets up to a given amount of messages in this channel before a given message in any channel.
        Parameters:
        limit - The limit of messages to get.
        before - Get messages before the message with this id.
        Returns:
        The messages.
        See Also:
        getMessagesBeforeAsStream(long)
      • getMessagesBefore

        default CompletableFuture<MessageSet> getMessagesBefore​(int limit,
                                                                Message before)
        Gets up to a given amount of messages in this channel before a given message in any channel.
        Parameters:
        limit - The limit of messages to get.
        before - Get messages before this message.
        Returns:
        The messages.
        See Also:
        getMessagesBeforeAsStream(Message)
      • getMessagesBeforeUntil

        CompletableFuture<MessageSet> getMessagesBeforeUntil​(Predicate<Message> condition,
                                                             long before)
        Gets messages in this channel before a given message in any channel until one that meets the given condition is found. If no message matches the condition, an empty set is returned.
        Parameters:
        condition - The abort condition for when to stop retrieving messages.
        before - Get messages before the message with this id.
        Returns:
        The messages.
        See Also:
        getMessagesBeforeAsStream(long)
      • getMessagesBeforeUntil

        default CompletableFuture<MessageSet> getMessagesBeforeUntil​(Predicate<Message> condition,
                                                                     Message before)
        Gets messages in this channel before a given message in any channel until one that meets the given condition is found. If no message matches the condition, an empty set is returned.
        Parameters:
        condition - The abort condition for when to stop retrieving messages.
        before - Get messages before this message.
        Returns:
        The messages.
        See Also:
        getMessagesBeforeAsStream(Message)
      • getMessagesBeforeWhile

        CompletableFuture<MessageSet> getMessagesBeforeWhile​(Predicate<Message> condition,
                                                             long before)
        Gets messages in this channel before a given message in any channel while they meet the given condition. If the first message does not match the condition, an empty set is returned.
        Parameters:
        condition - The condition that has to be met.
        before - Get messages before the message with this id.
        Returns:
        The messages.
        See Also:
        getMessagesBeforeAsStream(long)
      • getMessagesBeforeWhile

        default CompletableFuture<MessageSet> getMessagesBeforeWhile​(Predicate<Message> condition,
                                                                     Message before)
        Gets messages in this channel before a given message in any channel while they meet the given condition. If the first message does not match the condition, an empty set is returned.
        Parameters:
        condition - The condition that has to be met.
        before - Get messages before this message.
        Returns:
        The messages.
        See Also:
        getMessagesBeforeAsStream(Message)
      • getMessagesBeforeAsStream

        Stream<Message> getMessagesBeforeAsStream​(long before)
        Gets a stream of messages in this channel before a given message in any channel sorted from newest to oldest.

        The messages are retrieved in batches synchronously from Discord, so consider not using this method from a listener directly.

        Parameters:
        before - Get messages before the message with this id.
        Returns:
        The stream.
        See Also:
        getMessagesBefore(int, long)
      • getMessagesBeforeAsStream

        default Stream<Message> getMessagesBeforeAsStream​(Message before)
        Gets a stream of messages in this channel before a given message in any channel sorted from newest to oldest.

        The messages are retrieved in batches synchronously from Discord, so consider not using this method from a listener directly.

        Parameters:
        before - Get messages before this message.
        Returns:
        The stream.
        See Also:
        getMessagesBefore(int, Message)
      • getMessagesAfter

        CompletableFuture<MessageSet> getMessagesAfter​(int limit,
                                                       long after)
        Gets up to a given amount of messages in this channel after a given message in any channel.
        Parameters:
        limit - The limit of messages to get.
        after - Get messages after the message with this id.
        Returns:
        The messages.
        See Also:
        getMessagesAfterAsStream(long)
      • getMessagesAfter

        default CompletableFuture<MessageSet> getMessagesAfter​(int limit,
                                                               Message after)
        Gets up to a given amount of messages in this channel after a given message in any channel.
        Parameters:
        limit - The limit of messages to get.
        after - Get messages after this message.
        Returns:
        The messages.
        See Also:
        getMessagesAfterAsStream(Message)
      • getMessagesAfterUntil

        CompletableFuture<MessageSet> getMessagesAfterUntil​(Predicate<Message> condition,
                                                            long after)
        Gets messages in this channel after a given message in any channel until one that meets the given condition is found. If no message matches the condition, an empty set is returned.
        Parameters:
        condition - The abort condition for when to stop retrieving messages.
        after - Get messages after the message with this id.
        Returns:
        The messages.
        See Also:
        getMessagesAfterAsStream(long)
      • getMessagesAfterUntil

        default CompletableFuture<MessageSet> getMessagesAfterUntil​(Predicate<Message> condition,
                                                                    Message after)
        Gets messages in this channel after a given message in any channel until one that meets the given condition is found. If no message matches the condition, an empty set is returned.
        Parameters:
        condition - The abort condition for when to stop retrieving messages.
        after - Get messages after this message.
        Returns:
        The messages.
        See Also:
        getMessagesAfterAsStream(Message)
      • getMessagesAfterWhile

        CompletableFuture<MessageSet> getMessagesAfterWhile​(Predicate<Message> condition,
                                                            long after)
        Gets messages in this channel after a given message in any channel while they meet the given condition. If the first message does not match the condition, an empty set is returned.
        Parameters:
        condition - The condition that has to be met.
        after - Get messages after the message with this id.
        Returns:
        The messages.
        See Also:
        getMessagesAfterAsStream(long)
      • getMessagesAfterWhile

        default CompletableFuture<MessageSet> getMessagesAfterWhile​(Predicate<Message> condition,
                                                                    Message after)
        Gets messages in this channel after a given message in any channel while they meet the given condition. If the first message does not match the condition, an empty set is returned.
        Parameters:
        condition - The condition that has to be met.
        after - Get messages after this message.
        Returns:
        The messages.
        See Also:
        getMessagesAfterAsStream(Message)
      • getMessagesAfterAsStream

        Stream<Message> getMessagesAfterAsStream​(long after)
        Gets a stream of messages in this channel after a given message in any channel sorted from oldest to newest.

        The messages are retrieved in batches synchronously from Discord, so consider not using this method from a listener directly.

        Parameters:
        after - Get messages after the message with this id.
        Returns:
        The messages.
        See Also:
        getMessagesAfter(int, long)
      • getMessagesAfterAsStream

        default Stream<Message> getMessagesAfterAsStream​(Message after)
        Gets a stream of messages in this channel after a given message in any channel sorted from oldest to newest.

        The messages are retrieved in batches synchronously from Discord, so consider not using this method from a listener directly.

        Parameters:
        after - Get messages after this message.
        Returns:
        The stream.
        See Also:
        getMessagesAfter(int, Message)
      • getMessagesAround

        CompletableFuture<MessageSet> getMessagesAround​(int limit,
                                                        long around)
        Gets up to a given amount of messages in this channel around a given message in any channel. The given message will be part of the result in addition to the messages around if it was sent in this channel and does not count towards the limit. Half of the messages will be older than the given message and half of the messages will be newer. If there aren't enough older or newer messages, the actual amount of messages will be less than the given limit. It's also not guaranteed to be perfectly balanced.
        Parameters:
        limit - The limit of messages to get.
        around - Get messages around the message with this id.
        Returns:
        The messages.
        See Also:
        getMessagesAroundAsStream(long)
      • getMessagesAround

        default CompletableFuture<MessageSet> getMessagesAround​(int limit,
                                                                Message around)
        Gets up to a given amount of messages in this channel around a given message in any channel. The given message will be part of the result in addition to the messages around if it was sent in this channel and does not count towards the limit. Half of the messages will be older than the given message and half of the messages will be newer. If there aren't enough older or newer messages, the actual amount of messages will be less than the given limit. It's also not guaranteed to be perfectly balanced.
        Parameters:
        limit - The limit of messages to get.
        around - Get messages around this message.
        Returns:
        The messages.
        See Also:
        getMessagesAroundAsStream(Message)
      • getMessagesAroundUntil

        CompletableFuture<MessageSet> getMessagesAroundUntil​(Predicate<Message> condition,
                                                             long around)
        Gets messages in this channel around a given message in any channel until one that meets the given condition is found. If no message matches the condition, an empty set is returned. The given message will be part of the result in addition to the messages around if it was sent in this channel and is matched against the condition and will abort retrieval. Half of the messages will be older than the given message and half of the messages will be newer. If there aren't enough older or newer messages, the actual amount of messages will be less than the given limit. It's also not guaranteed to be perfectly balanced.
        Parameters:
        condition - The abort condition for when to stop retrieving messages.
        around - Get messages around the message with this id.
        Returns:
        The messages.
        See Also:
        getMessagesAroundAsStream(long)
      • getMessagesAroundUntil

        default CompletableFuture<MessageSet> getMessagesAroundUntil​(Predicate<Message> condition,
                                                                     Message around)
        Gets messages in this channel around a given message in any channel until one that meets the given condition is found. If no message matches the condition, an empty set is returned. The given message will be part of the result in addition to the messages around if it was sent in this channel and is matched against the condition and will abort retrieval. Half of the messages will be older than the given message and half of the messages will be newer. If there aren't enough older or newer messages, the actual amount of messages will be less than the given limit. It's also not guaranteed to be perfectly balanced.
        Parameters:
        condition - The abort condition for when to stop retrieving messages.
        around - Get messages around this message.
        Returns:
        The messages.
        See Also:
        getMessagesAroundAsStream(Message)
      • getMessagesAroundWhile

        CompletableFuture<MessageSet> getMessagesAroundWhile​(Predicate<Message> condition,
                                                             long around)
        Gets messages in this channel around a given message in any channel while they meet the given condition. If the first message does not match the condition, an empty set is returned. The given message will be part of the result in addition to the messages around if it was sent in this channel and is matched against the condition and will abort retrieval. Half of the messages will be older than the given message and half of the messages will be newer. If there aren't enough older or newer messages, the actual amount of messages will be less than the given limit. It's also not guaranteed to be perfectly balanced.
        Parameters:
        condition - The condition that has to be met.
        around - Get messages around the message with this id.
        Returns:
        The messages.
        See Also:
        getMessagesAroundAsStream(long)
      • getMessagesAroundWhile

        default CompletableFuture<MessageSet> getMessagesAroundWhile​(Predicate<Message> condition,
                                                                     Message around)
        Gets messages in this channel around a given message in any channel while they meet the given condition. If the first message does not match the condition, an empty set is returned. The given message will be part of the result in addition to the messages around if it was sent in this channel and is matched against the condition and will abort retrieval. Half of the messages will be older than the given message and half of the messages will be newer. If there aren't enough older or newer messages, the actual amount of messages will be less than the given limit. It's also not guaranteed to be perfectly balanced.
        Parameters:
        condition - The condition that has to be met.
        around - Get messages around this message.
        Returns:
        The messages.
        See Also:
        getMessagesAroundAsStream(Message)
      • getMessagesAroundAsStream

        Stream<Message> getMessagesAroundAsStream​(long around)
        Gets a stream of messages in this channel around a given message in any channel. The first message in the stream will be the given message if it was sent in this channel. After that you will always get an older message and a newer message alternating as long as on both sides messages are available. If only on one side further messages are available, only those are delivered further on. It's not guaranteed to be perfectly balanced.

        The messages are retrieved in batches synchronously from Discord, so consider not using this method from a listener directly.

        Parameters:
        around - Get messages around the message with this id.
        Returns:
        The stream.
        See Also:
        getMessagesAround(int, long)
      • getMessagesAroundAsStream

        default Stream<Message> getMessagesAroundAsStream​(Message around)
        Gets a stream of messages in this channel around a given message in any channel. The first message in the stream will be the given message if it was sent in this channel. After that you will always get an older message and a newer message alternating as long as on both sides messages are available. If only on one side further messages are available, only those are delivered further on. It's not guaranteed to be perfectly balanced.

        The messages are retrieved in batches synchronously from Discord, so consider not using this method from a listener directly.

        Parameters:
        around - Get messages around this message.
        Returns:
        The stream.
        See Also:
        getMessagesAround(int, Message)
      • getMessagesBetween

        CompletableFuture<MessageSet> getMessagesBetween​(long from,
                                                         long to)
        Gets all messages in this channel between the first given message in any channel and the second given message in any channel, excluding the boundaries.
        Parameters:
        from - The id of the start boundary messages.
        to - The id of the other boundary messages.
        Returns:
        The messages.
        See Also:
        getMessagesBetweenAsStream(long, long)
      • getMessagesBetween

        default CompletableFuture<MessageSet> getMessagesBetween​(Message from,
                                                                 Message to)
        Gets all messages in this channel between the first given message in any channel and the second given message in any channel, excluding the boundaries.
        Parameters:
        from - The start boundary messages.
        to - The other boundary messages.
        Returns:
        The messages.
        See Also:
        getMessagesBetweenAsStream(long, long)
      • getMessagesBetweenUntil

        CompletableFuture<MessageSet> getMessagesBetweenUntil​(Predicate<Message> condition,
                                                              long from,
                                                              long to)
        Gets all messages in this channel between the first given message in any channel and the second given message in any channel, excluding the boundaries, until one that meets the given condition is found. If no message matches the condition, an empty set is returned.
        Parameters:
        condition - The abort condition for when to stop retrieving messages.
        from - The id of the start boundary messages.
        to - The id of the other boundary messages.
        Returns:
        The messages.
        See Also:
        getMessagesBetweenAsStream(long, long)
      • getMessagesBetweenUntil

        default CompletableFuture<MessageSet> getMessagesBetweenUntil​(Predicate<Message> condition,
                                                                      Message from,
                                                                      Message to)
        Gets all messages in this channel between the first given message in any channel and the second given message in any channel, excluding the boundaries, until one that meets the given condition is found. If no message matches the condition, an empty set is returned.
        Parameters:
        condition - The abort condition for when to stop retrieving messages.
        from - The start boundary messages.
        to - The other boundary messages.
        Returns:
        The messages.
        See Also:
        getMessagesBetweenAsStream(long, long)
      • getMessagesBetweenWhile

        CompletableFuture<MessageSet> getMessagesBetweenWhile​(Predicate<Message> condition,
                                                              long from,
                                                              long to)
        Gets all messages in this channel between the first given message in any channel and the second given message in any channel, excluding the boundaries, while they meet the given condition. If the first message does not match the condition, an empty set is returned.
        Parameters:
        condition - The condition that has to be met.
        from - The id of the start boundary messages.
        to - The id of the other boundary messages.
        Returns:
        The messages.
        See Also:
        getMessagesBetweenAsStream(long, long)
      • getMessagesBetweenWhile

        default CompletableFuture<MessageSet> getMessagesBetweenWhile​(Predicate<Message> condition,
                                                                      Message from,
                                                                      Message to)
        Gets all messages in this channel between the first given message in any channel and the second given message in any channel, excluding the boundaries, while they meet the given condition. If the first message does not match the condition, an empty set is returned.
        Parameters:
        condition - The condition that has to be met.
        from - The start boundary messages.
        to - The other boundary messages.
        Returns:
        The messages.
        See Also:
        getMessagesBetweenAsStream(long, long)
      • getMessagesBetweenAsStream

        Stream<Message> getMessagesBetweenAsStream​(long from,
                                                   long to)
        Gets all messages in this channel between the first given message in any channel and the second given message in any channel, excluding the boundaries, sorted from first given message to the second given message.

        The messages are retrieved in batches synchronously from Discord, so consider not using this method from a listener directly.

        Parameters:
        from - The id of the start boundary messages.
        to - The id of the other boundary messages.
        Returns:
        The stream.
        See Also:
        getMessagesBetween(long, long)
      • getMessagesBetweenAsStream

        default Stream<Message> getMessagesBetweenAsStream​(Message from,
                                                           Message to)
        Gets all messages in this channel between the first given message in any channel and the second given message in any channel, excluding the boundaries, sorted from first given message to the second given message.

        The messages are retrieved in batches synchronously from Discord, so consider not using this method from a listener directly.

        Parameters:
        from - The start boundary messages.
        to - The other boundary messages.
        Returns:
        The stream.
        See Also:
        getMessagesBetween(long, long)
      • getMessageCache

        MessageCache getMessageCache​()
        Gets the message cache for the channel.
        Returns:
        The message cache for the channel.
      • getWebhooks

        CompletableFuture<List<Webhook>> getWebhooks​()
        Gets a list of all webhooks in this channel.
        Returns:
        A list of all webhooks in this channel.
      • canWrite

        default boolean canWrite​(User user)
        Checks if the given user can send messages in this channel. In private chats (private channel or group channel) this always returns true if the user is part of the chat. Please notice, this does not check if a user has blocked private messages!
        Parameters:
        user - The user to check.
        Returns:
        Whether the given user can write messages or not.
      • canYouWrite

        default boolean canYouWrite​()
        Checks if the user of the connected account can send messages in this channel. In private chats (private channel or group channel) this always returns true if the user is part of the chat. Please notice, this does not check if a user has blocked private messages!
        Returns:
        Whether the user of the connected account can write messages or not.
      • canUseExternalEmojis

        default boolean canUseExternalEmojis​(User user)
        Checks if the given user can use external emojis in this channel. In private chats (private channel or group channel) this always returns true if the user is part of the chat. Please notice, this does not check if a user has blocked private messages! It also doesn't check if the user is even able to send any external emojis (twitch subscription or nitro).
        Parameters:
        user - The user to check.
        Returns:
        Whether the given user can use external emojis or not.
      • canYouUseExternalEmojis

        default boolean canYouUseExternalEmojis​()
        Checks if the user of the connected account can use external emojis in this channel. In private chats (private channel or group channel) this always returns true if the user is part of the chat. Please notice, this does not check if a user has blocked private messages! It also doesn't check if the user is even able to send any external emojis (twitch subscription or nitro).
        Returns:
        Whether the user of the connected account can use external emojis or not.
      • canEmbedLinks

        default boolean canEmbedLinks​(User user)
        Checks if the given user can use embed links in this channel. In private chats (private channel or group channel) this always returns true if the user is part of the chat. Please notice, this does not check if a user has blocked private messages!
        Parameters:
        user - The user to check.
        Returns:
        Whether the given user can embed links or not.
      • canYouEmbedLinks

        default boolean canYouEmbedLinks​()
        Checks if the user of the connected account can use embed links in this channel. In private chats (private channel or group channel) this always returns true if the user is part of the chat. Please notice, this does not check if a user has blocked private messages!
        Returns:
        Whether the user of the connected account can embed links or not.
      • canReadMessageHistory

        default boolean canReadMessageHistory​(User user)
        Checks if the given user can read the message history of this channel. In private chats (private channel or group channel) this always returns true if the user is part of the chat.
        Parameters:
        user - The user to check.
        Returns:
        Whether the given user can read the message history or not.
      • canYouReadMessageHistory

        default boolean canYouReadMessageHistory​()
        Checks if the user of the connected account can read the message history of this channel. In private chats (private channel or group channel) this always returns true if the user is part of the chat.
        Returns:
        Whether the user of the connected account can read the message history or not.
      • canUseTts

        default boolean canUseTts​(User user)
        Checks if the given user can use tts (text to speech) in this channel. In private chats (private channel or group channel) this always returns true if the user is part of the chat. Please notice, this does not check if a user has blocked private messages!
        Parameters:
        user - The user to check.
        Returns:
        Whether the given user can use tts or not.
      • canYouUseTts

        default boolean canYouUseTts​()
        Checks if the user of the connected account can use tts (text to speech) in this channel. In private chats (private channel or group channel) this always returns true if the user is part of the chat. Please notice, this does not check if a user has blocked private messages!
        Returns:
        Whether the user of the connected account can use tts or not.
      • canAttachFiles

        default boolean canAttachFiles​(User user)
        Checks if the given user can attach files in this channel.
        Parameters:
        user - The user to check.
        Returns:
        Whether the given user can attach files or not.
      • canYouAttachFiles

        default boolean canYouAttachFiles​()
        Checks if the user of the connected account can attach files in this channel.
        Returns:
        Whether the user of the connected account can attach files or not.
      • canAddNewReactions

        default boolean canAddNewReactions​(User user)
        Checks if the given user is allowed to add new reactions to messages in this channel.
        Parameters:
        user - The user to check.
        Returns:
        Whether the given user is allowed to add new reactions to messages in this channel or not.
      • canYouAddNewReactions

        default boolean canYouAddNewReactions​()
        Checks if the user of the connected account is allowed to add new reactions to messages in this channel.
        Returns:
        Whether the user of the connected account is allowed to add new reactions to messages in this channel or not.
      • canManageMessages

        default boolean canManageMessages​(User user)
        Checks if the given user can manage messages (delete or pin them or remove reactions of others) in this channel. In private chats (private channel or group channel) this always returns true if the user is part of the chat.
        Parameters:
        user - The user to check.
        Returns:
        Whether the given user can manage messages or not.
      • canYouManageMessages

        default boolean canYouManageMessages​()
        Checks if the user of the connected account can manage messages (delete or pin them or remove reactions of others) in this channel. In private chats (private channel or group channel) this always returns true if the user is part of the chat.
        Returns:
        Whether the user of the connected account can manage messages or not.
      • canRemoveReactionsOfOthers

        default boolean canRemoveReactionsOfOthers​(User user)
        Checks if the given user can remove reactions of other users in this channel. In private chats (private channel or group channel) this always returns true if the user is part of the chat. This method just forwards to canManageMessages(User) as it is the same permission that is needed.
        Parameters:
        user - The user to check.
        Returns:
        Whether the given user can remove reactions of others or not.
      • canYouRemoveReactionsOfOthers

        default boolean canYouRemoveReactionsOfOthers​()
        Checks if the user of the connected account can remove reactions of other users in this channel. In private chats (private channel or group channel) this always returns true if the user is part of the chat.
        Returns:
        Whether the user of the connected account can remove reactions of others or not.
      • canMentionEveryone

        default boolean canMentionEveryone​(User user)
        Checks if the given user can mention everyone (@everyone) in this channel. In private chats (private channel or group channel) this always returns true if the user is part of the chat.
        Parameters:
        user - The user to check.
        Returns:
        Whether the given user can mention everyone (@everyone) or not.
      • canYouMentionEveryone

        default boolean canYouMentionEveryone​()
        Checks if the user of the connected account can mention everyone (@everyone) in this channel. In private chats (private channel or group channel) this always returns true if the user is part of the chat.
        Returns:
        Whether the user of the connected account can mention everyone (@everyone) or not.
      • getCurrentCachedInstance

        default Optional<? extends TextChannel> getCurrentCachedInstance​()
        Description copied from interface: UpdatableFromCache
        Gets an updated instance of this entity from the cache. This is for example necessary if an instance got invalid by a reconnect to Discord which invalidates all existing instances which means they do not get any further updates from Discord applied. Due to that, references to instances should usually not be held for an extended period of time. If they are, this method can be used to retrieve the current instance from the cache, that gets updates from Discord, in case this one was invalidated.

        This method returns the currently cached entity, or an empty Optional if the entity is not cached any longer, for example because it was deleted or the message was thrown out of the cache.

        Specified by:
        getCurrentCachedInstance in interface Channel
        Specified by:
        getCurrentCachedInstance in interface UpdatableFromCache
        Returns:
        The current cached instance.
      • getLatestInstance

        default CompletableFuture<? extends TextChannel> getLatestInstance​()
        Description copied from interface: Updatable
        Gets an updated instance of this entity from the cache or from Discord directly. This is for example necessary if an instance got invalid by a reconnect to Discord which invalidates all existing instances which means they do not get any further updates from Discord applied. Due to that, references to instances should usually not be held for an extended period of time. If they are, this method can be used to retrieve the current instance from the cache if present or from Discord directly.

        This method returns the currently cached entity if present, or request the entity from Discord if it is not cached or not permanently cached. If the entity is a fully cached entity and is not in the cache any longer, for example because it was deleted or the message was thrown out of the cache, the CompletableFuture completes exceptionally with a NoSuchElementException. If a request to Discord is made, the according remote call exception will be used to complete the CompletableFuture exceptionally.

        Specified by:
        getLatestInstance in interface Channel
        Specified by:
        getLatestInstance in interface Updatable<T extends DiscordEntity>
        Specified by:
        getLatestInstance in interface UpdatableFromCache
        Returns:
        The current cached instance.