Skip to main content

messages.sendPaidReaction

Sends one or more paid Telegram Star reactions », transferring Telegram Stars » to a channel's balance.

func (c *Client) MessagesSendPaidReaction(ctx context.Context, request *MessagesSendPaidReactionRequest) (UpdatesClass, error)

Calling this method

client.Run(ctx, func(ctx context.Context) error {
api := client.API()

res, err := api.MessagesSendPaidReaction(ctx, &tg.MessagesSendPaidReactionRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // UpdatesClass
return nil
})

Parameters

NameTypeRequiredDescription
PeerInputPeerClassyesThe channel
MsgIDintyesThe message to react to
CountintyesThe number of stars to send (each will increment the reaction counter by one).
RandomIDint64yesUnique 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. `uint64_t random_id = (time() << 32)
PrivatePaidReactionPrivacyClassEach 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 updatePaidReactionPrivacy (see here for more info).

Returns

UpdatesClass

Possible errors

CodeTypeDescription
400BALANCE_TOO_LOWThe transaction cannot be completed because the current Telegram Stars balance is too low.
400CHANNEL_INVALIDThe provided channel is invalid.
403CHAT_WRITE_FORBIDDENYou can't write in this chat.
400MESSAGE_ID_INVALIDThe provided message id is invalid.
400PEER_ID_INVALIDThe provided peer id is invalid.
400RANDOM_ID_EMPTYRandom ID empty.
400RANDOM_ID_EXPIREDThe specified random_id was expired (most likely it didn't follow the required `uint64_t random_id = (time() << 32)
400REACTIONS_COUNT_INVALIDThe specified number of reactions is invalid.
400SEND_AS_PEER_INVALIDYou can't send messages as the specified peer.

References