Skip to main content

messages.setGameScore

Use this method to set the score of the specified user in a game sent as a normal message (bots only).

func (c *Client) MessagesSetGameScore(ctx context.Context, request *MessagesSetGameScoreRequest) (UpdatesClass, error)

Calling this method

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

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

Parameters

NameTypeRequiredDescription
EditMessageboolSet this flag if the game message should be automatically edited to include the current scoreboard
ForceboolSet this flag if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters
PeerInputPeerClassyesUnique identifier of target chat
IDintyesIdentifier of the sent message
UserIDInputUserClassyesUser identifier
ScoreintyesNew score

Returns

UpdatesClass

Possible errors

CodeTypeDescription
400BOT_SCORE_NOT_MODIFIEDThe score wasn't modified.
400MESSAGE_ID_INVALIDThe provided message id is invalid.
400PEER_ID_INVALIDThe provided peer id is invalid.
400SCORE_INVALIDThe specified game score is invalid.
400USER_BOT_REQUIREDThis method can only be called by a bot.

References