+
+ 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'");
+ }
+ return new Message.Sticker(Hex.toByteArray(matcher.group(1)), Integer.parseInt(matcher.group(2)));
+ }