- private void outputResult(final OutputWriter outputWriter, final long timestamp) {
- if (outputWriter instanceof PlainTextWriter writer) {
- writer.println("{}", timestamp);
- } else {
- final var writer = (JsonWriter) outputWriter;
- writer.write(Map.of("timestamp", timestamp));
+ private Message.Sticker parseSticker(final String stickerString) throws UserErrorException {
+ final Pattern stickerPattern = Pattern.compile("([0-9a-f]+):([0-9]+)");
+ final var matcher = stickerPattern.matcher(stickerString);
+ if (!matcher.matches() || matcher.group(1).length() % 2 != 0) {
+ throw new UserErrorException("Invalid sticker syntax ("
+ + stickerString
+ + ") expected 'stickerPackId:stickerId'");