# messages.setInlineGameScore

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

## Example

{% tabs %}
{% tab title="Javascript" %}

```javascript
const {Api, TelegramClient} = require('telegram');
const {StringSession} = require('telegram/sessions');

const session = new StringSession('');
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
    const result = await client.invoke(new Api.messages.setInlineGameScore({
        editMessage: true,
        force: true,
        id: new Api.InputBotInlineMessageID({...}),
        userId: new Api.InputUser({...}),
        score: 3916422,
        }));
    console.log(result); // prints the result
})();
```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
import {Api, TelegramClient} from 'telegram';
import {StringSession} from 'telegram/sessions';

const session = new StringSession('');
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
    const result: Api.Bool = await client.invoke(new Api.messages.setInlineGameScore({
        editMessage: true,
        force: true,
        id: new Api.InputBotInlineMessageID({...}),
        userId: new Api.InputUser({...}),
        score: 3916422,
        }));
    console.log(result); // prints the result
})();
```

{% endtab %}
{% endtabs %}

## TL schema

```
boolFalse#bc799737 = Bool;
boolTrue#997275b5 = Bool;
---functions---
messages.setInlineGameScore#15ad9f64 flags:# edit_message:flags.0?true force:flags.1?true id:InputBotInlineMessageID user_id:InputUser score:int = Bool;
```

## Parameters

|        Name       | Type                                                                                                                              | Description                                                                                                         |
| :---------------: | --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
|     **flags**     | [#](https://core.telegram.org/type/%23)                                                                                           | Flags, see [TL conditional fields](https://core.telegram.org/mtproto/TL-combinators#conditional-fields)             |
| **edit\_message** | [flags](https://core.telegram.org/mtproto/TL-combinators#conditional-fields).0?[true](https://core.telegram.org/constructor/true) | Set this flag if the game message should be automatically edited to include the current scoreboard                  |
|     **force**     | [flags](https://core.telegram.org/mtproto/TL-combinators#conditional-fields).1?[true](https://core.telegram.org/constructor/true) | Set this flag if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters |
|       **id**      | [InputBotInlineMessageID](https://core.telegram.org/type/InputBotInlineMessageID)                                                 | ID of the inline message                                                                                            |
|    **user\_id**   | [InputUser](https://core.telegram.org/type/InputUser)                                                                             | User identifier                                                                                                     |
|     **score**     | [int](https://core.telegram.org/type/int)                                                                                         | New score                                                                                                           |

## Result

[Bool](https://core.telegram.org/type/Bool)

## Possible errors

| Code | Type                 | Description                             |
| :--: | -------------------- | --------------------------------------- |
|  400 | MESSAGE\_ID\_INVALID | The provided message id is invalid      |
|  400 | USER\_BOT\_REQUIRED  | This method can only be called by a bot |

## Can bots use this methd ?

### yes

## Related pages


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://painor.gitbook.io/gramjs/working-with-games/messages.setinlinegamescore.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
