setGameScore method
Sets the score of the specified user in a game message.
Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the Message is returned, otherwise True is returned.
Implementation
Future<dynamic> setGameScore(
int userId,
int score, {
bool? force,
bool? disableEditMessage,
ID? chatId,
int? messageId,
String? inlineMessageId,
}) async {
final params = <String, dynamic>{
'user_id': userId,
'score': score,
'force': ?force,
'disable_edit_message': ?disableEditMessage,
'chat_id': ?chatId,
'message_id': ?messageId,
'inline_message_id': ?inlineMessageId,
};
final payload = Payload(params);
final response = await _makeRequest<dynamic>(
APIMethod.setGameScore.name,
payload,
);
// Response can be either Message or bool
if (response is Map<String, dynamic>) {
return Message.fromJson(response);
}
return response as bool;
}