Layer 220
MessagesSendPaidReaction
Sends one or more paid Telegram Star reactions, transferring Telegram Stars to a channel's balance.
method
Users
messages.sendPaidReaction#58bbcb50 flags:# peer:InputPeer msg_id:int count:int random_id:long private:flags.0?PaidReactionPrivacy = Updates;
Parameters
| Name | Type | Description |
|---|---|---|
| Flags | # | Flags, see TL conditional fields |
| Peer | InputPeer | The channel |
| MsgId | int | The message to react to |
| Count | int | The number of stars to send (each will increment the reaction counter by one). |
| RandomId | long | Unique client message ID required to prevent message resending. Note: this argument must be composed of a 64-bit integer where the lower 32 bits are random, and the higher 32 bits are equal to the current unixtime, i. e. uint 64_t random_id = (time() << 32) | ((uint 64_t)random_uint 32_t()): this differs from the random_id format of all other methods in the API, which just take 64 random bits. |
| Private | flags.0?PaidReactionPrivacy | Each post with star reactions has a leaderboard with the top senders, but users can opt out of appearing there if they prefer more privacy. Not populating this field will use the default reaction privacy, stored on the server and synced to clients using update Paid Reaction Privacy (see here for more info). |
Returns
UpdatesPossible Errors
| Code | Type | Description |
|---|---|---|
| 400 | BALANCE_TOO_LOW | The transaction cannot be completed because the current Telegram Stars balance is too low. |
| 400 | CHANNEL_INVALID | The provided channel is invalid. |
| 403 | CHAT_WRITE_FORBIDDEN | You can't write in this chat. |
| 400 | MESSAGE_ID_INVALID | The provided message id is invalid. |
| 400 | PEER_ID_INVALID | The provided peer id is invalid. |
| 400 | RANDOM_ID_EMPTY | Random ID empty. |
| 400 | RANDOM_ID_EXPIRED | The specified random_id was expired (most likely it didn't follow the required uint 64_t random_id = (time() << 32) | ((uint 64_t)random_uint 32_t()) format, or the specified time is too far in the past). |
| 400 | REACTIONS_COUNT_INVALID | The specified number of reactions is invalid. |
| 400 | SEND_AS_PEER_INVALID | You can't send messages as the specified peer. |
Gogram Example
// MessagesSendPaidReaction - using Params struct result, err := client.MessagesSendPaidReaction(&tg.MessagesSendPaidReactionParams{ Peer: &tg.InputPeerUser{UserID: int64(123456789)}, MsgId: 0, Count: 0, RandomId: int64(0), // Optional fields: // Private: &tg.PaidReactionPrivacy{}, }) if err != nil { // handle error } // result is *tg.Updates