de.malkusch.telgrambot.PinnedMessage Maven / Gradle / Ivy
package de.malkusch.telgrambot;
import java.util.List;
import static java.util.Arrays.asList;
import static java.util.Arrays.stream;
import static java.util.Objects.requireNonNull;
public sealed interface PinnedMessage {
NoMessage NO_MESSAGE = new NoMessage();
record NoMessage() implements PinnedMessage {
}
record TextMessage(MessageId id, String text) implements PinnedMessage {
public TextMessage {
requireNonNull(id);
requireNonNull(text);
if (text.isBlank()) {
throw new IllegalArgumentException("text must not be empty");
}
}
}
record CallbackMessage(MessageId id, String text, List