Dice

Telegram supports sending animated dice emojis.
This is implemented by using the dice constructors:

inputMediaDice#e66fbf7b emoticon:string = InputMedia;
messageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia;

inputStickerSetDice#e67f520e emoticon:string = InputStickerSet;

messages.stickerSet#b60a24a6 set:StickerSet packs:Vector<StickerPack> documents:Vector<Document> = messages.StickerSet;

---functions---

messages.sendMedia#e25ff8e0 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates;

messages.getStickerSet#c8a0ec74 stickerset:InputStickerSet hash:int = messages.StickerSet;

help.getAppConfig#98914110 = JSONValue;

On startup, clients should fetch app configuration using help.getAppConfig.
Then, for each dice emoji contained in the emojies_send_dice field, clients should fetch the dice emoji stickerset by calling the messages.getStickerSet method, providing the properly populated inputStickerSetDice to the stickerset field.
The returned stickerset will contain a set of animated stickers, one for each of the dice outcomes, plus a first looping sticker that should be shown as preview to the user before actually sending the dice.

If a user attempts to send a single emoji from the ones specified in emojies_send_dice, the dice should be sent using messages.sendMedia, providing the dice emoji to the emoticon field.

Incoming dice stickers will be received as a messageMediaDice constructor, along with a randomly generated server-side value, ranging from 1 to the maximum allowed value for this type of dice.
Clients should display the correct dice animated sticker for the specified value: since dice values start from 1, and the first animated sticker in dice stickerset is the preview, value can be used to directly index the documents sticker array from the animated stickerset.

The emojies_send_dice_success configuration parameter contains more info about dice emojis other than the basic 🎲:

    "emojies_send_dice_success": {
        "\ud83c\udfaf": {
            "value": 6,
            "frame_start": 62
        },
        "\ud83c\udfc0": {
            "value": 5,
            "frame_start": 110
        }
    }

For each of the dice emojis, a maximum "winning" value is specified, along with the frame number at which to show the fireworks 🎆.
Please note that dice animated stickers should loop only once, right after being sent/received for the first time; clicking on the dice sticker should bring up a popup, inviting the user to send a new dice of the same type.

Ir arriba