code: public static CompletableFuture<MessageSet> getMessagesAround(TextChannel channel, int limit, long around) {
          CompletableFuture<MessageSet> future = new CompletableFuture<>();
          channel.getApi().getThreadPool().getExecutorService().submit(() -> {
              try {
                  // calculate the half limit.
                  int halfLimit = limit / 2;
  
                  // get the newer half
                  MessageSet newerMessages = getMessagesAfter(channel, halfLimit, around).join();
  
                  // get the older half + around message
                  MessageSet olderMessages = getMessagesBefore(channel, halfLimit + 1, around + 1).join();
  
                  // remove the oldest message if the around message is not part of the result while there is a result,
                  // for example because the around message was from a different channel
                  if (olderMessages.getNewestMessage()
                          .map(DiscordEntity::getId)
                          .map(id -> id != around)
                          .orElse(false)) {
                      olderMessages = olderMessages.tailSet(
                              olderMessages.getOldestMessage().orElseThrow(AssertionError::new),
                              false);
                  }
  
                  // combine the messages into one collection
                  Collection<Message> messages = Stream
                          .of(olderMessages, newerMessages)
                          .flatMap(Collection::stream)
                          .collect(Collectors.toList());
  
                  // we are done
                  future.complete(new MessageSetImpl(messages));
              } catch (Throwable t) {
                  future.completeExceptionally(t);
              }
          });
          return future;
      }
docs: Gets up to a given amount of messages in the given 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 the given
  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.
  
  @param channel The channel of the messages.
  @param limit The limit of messages to get.
  @param around Get messages around the message with this id.
  @return The messages.
  @see #getMessagesAroundAsStream(TextChannel, long)