📙
gramjs
  • Quick Start
  • Introduction
    • Advanced Installation
  • Concepts
    • Authentication
    • Updates (events)
    • Available methods
      • GetMessages
      • Uploading files
      • Downloading files
      • Getting participants of a group/channel
    • Handling Errors
    • Browser
  • FAQ
  • Raw Methods (Generated)
  • Accepting the Terms of Service
    • help.acceptTermsOfService
    • help.getTermsOfServiceUpdate
  • Dealing with spam and ToS violations
    • account.reportPeer
    • channels.reportSpam
    • messages.report
    • messages.reportEncryptedSpam
    • messages.reportSpam
  • Fetching configuration
    • help.dismissSuggestion
    • help.getAppChangelog
    • help.getAppConfig
    • help.getAppUpdate
    • help.getConfig
    • help.getCountriesList
    • help.getInviteText
    • help.getNearestDc
    • help.getSupport
    • help.getSupportName
  • Login via QR code
    • auth.acceptLoginToken
    • auth.exportLoginToken
    • auth.importLoginToken
  • Miscellaneous
    • help.saveAppLog
    • initConnection
    • invokeAfterMsg
    • invokeAfterMsgs
    • invokeWithLayer
    • invokeWithoutUpdates
  • Registration and Authorization
    • auth.bindTempAuthKey
    • auth.cancelCode
    • auth.checkPassword
    • auth.dropTempAuthKeys
    • auth.exportAuthorization
    • auth.importAuthorization
    • auth.importBotAuthorization
    • auth.logOut
    • auth.recoverPassword
    • auth.requestPasswordRecovery
    • auth.resendCode
    • auth.resetAuthorizations
    • auth.sendCode
    • auth.signIn
    • auth.signUp
  • Working with 2FA login
    • account.cancelPasswordEmail
    • account.confirmPasswordEmail
    • account.getPassword
    • account.getPasswordSettings
    • account.resendPasswordEmail
    • account.updatePasswordSettings
  • Working with bot inline queries and callback buttons
    • messages.editInlineBotMessage
    • messages.getBotCallbackAnswer
    • messages.getInlineBotResults
    • messages.sendInlineBotResult
    • messages.setBotCallbackAnswer
    • messages.setInlineBotResults
  • Working with bots (internal bot API use)
    • bots.answerWebhookJSONQuery
    • bots.sendCustomRequest
    • help.setBotUpdatesStatus
  • Working with bots
    • bots.setBotCommands
  • Working with channels and supergroups and geogroups
    • channels.createChannel
    • channels.deleteChannel
    • channels.deleteHistory
    • channels.deleteMessages
    • channels.deleteUserHistory
    • channels.editAdmin
    • channels.editBanned
    • channels.editCreator
    • channels.editLocation
    • channels.editPhoto
    • channels.editTitle
    • channels.exportMessageLink
    • channels.getAdminedPublicChannels
    • channels.getAdminLog
    • channels.getChannels
    • channels.getFullChannel
    • channels.getGroupsForDiscussion
    • channels.getInactiveChannels
    • channels.getMessages
    • channels.getParticipant
    • channels.getParticipants
    • channels.inviteToChannel
    • channels.joinChannel
    • channels.leaveChannel
    • channels.readHistory
    • channels.readMessageContents
    • channels.setDiscussionGroup
    • channels.setStickers
    • channels.togglePreHistoryHidden
    • channels.toggleSignatures
    • channels.toggleSlowMode
    • messages.getStatsURL
  • Working with chats and supergroups and channels
    • messages.addChatUser
    • messages.checkChatInvite
    • messages.createChat
    • messages.deleteChatUser
    • messages.editChatAbout
    • messages.editChatAdmin
    • messages.editChatDefaultBannedRights
    • messages.editChatPhoto
    • messages.editChatTitle
    • messages.exportChatInvite
    • messages.getAllChats
    • messages.getChats
    • messages.getCommonChats
    • messages.getFullChat
    • messages.importChatInvite
    • messages.migrateChat
  • Working with cloud themes
    • account.createTheme
    • account.getTheme
    • account.getThemes
    • account.installTheme
    • account.saveTheme
    • account.updateTheme
    • account.uploadTheme
  • Working with contacts and top peers
    • account.getContactSignUpNotification
    • account.setContactSignUpNotification
    • contacts.acceptContact
    • contacts.addContact
    • contacts.block
    • contacts.deleteByPhones
    • contacts.deleteContacts
    • contacts.getBlocked
    • contacts.getContactIDs
    • contacts.getContacts
    • contacts.getLocated
    • contacts.getSaved
    • contacts.getStatuses
    • contacts.getTopPeers
    • contacts.importContacts
    • contacts.resetSaved
    • contacts.resetTopPeerRating
    • contacts.search
    • contacts.toggleTopPeers
    • contacts.unblock
  • Working with credit cards
    • payments.getBankCardData
  • Working with deep links
    • help.getDeepLinkInfo
    • help.getRecentMeUrls
    • messages.startBot
  • Working with dialogs
    • messages.getDialogs
    • messages.getDialogUnreadMarks
    • messages.getOnlines
    • messages.getPeerDialogs
    • messages.getPeerSettings
    • messages.getPinnedDialogs
    • messages.hidePeerSettingsBar
    • messages.markDialogUnread
    • messages.reorderPinnedDialogs
    • messages.sendScreenshotNotification
    • messages.setTyping
    • messages.toggleDialogPin
  • Working with drafts
    • messages.clearAllDrafts
    • messages.getAllDrafts
    • messages.saveDraft
  • Working with emoji keywords
    • messages.getEmojiKeywords
    • messages.getEmojiKeywordsDifference
    • messages.getEmojiKeywordsLanguages
    • messages.getEmojiURL
  • Working with files
    • help.getCdnConfig
    • messages.getDocumentByHash
    • messages.uploadEncryptedFile
    • messages.uploadMedia
    • upload.getCdnFile
    • upload.getCdnFileHashes
    • upload.getFile
    • upload.getFileHashes
    • upload.getWebfile
    • upload.reuploadCdnFile
    • upload.saveBigFilePart
    • upload.saveFilePart
  • Working with folders
    • folders.deleteFolder
    • folders.editPeerFolders
    • messages.getDialogFilters
    • messages.getSuggestedDialogFilters
    • messages.updateDialogFilter
    • messages.updateDialogFiltersOrder
  • Working with games
    • messages.getGameHighScores
    • messages.getInlineGameHighScores
    • messages.setGameScore
    • messages.setInlineGameScore
  • Working with GDPR export
    • account.finishTakeoutSession
    • account.initTakeoutSession
    • channels.getLeftChannels
    • invokeWithMessagesRange
    • invokeWithTakeout
    • messages.getSplitRanges
  • Working with GIFs (actually MPEG4 GIFs)
    • messages.getSavedGifs
    • messages.saveGif
    • messages.searchGifs
  • Working with instant view pages
    • messages.getWebPage
    • messages.getWebPagePreview
  • Working with localization packs
    • langpack.getDifference
    • langpack.getLangPack
    • langpack.getLanguage
    • langpack.getLanguages
    • langpack.getStrings
  • Working with media autodownload settings
    • account.getAutoDownloadSettings
    • account.saveAutoDownloadSettings
  • Working with message reactions
    • messages.getMessageReactionsList
    • messages.getMessagesReactions
    • messages.sendReaction
  • Working with message threads
    • contacts.blockFromReplies
    • messages.getDiscussionMessage
    • messages.getReplies
    • messages.readDiscussion
  • Working with messages
    • messages.deleteHistory
    • messages.deleteMessages
    • messages.editMessage
    • messages.forwardMessages
    • messages.getHistory
    • messages.getMessageEditData
    • messages.getMessages
    • messages.getMessagesViews
    • messages.getRecentLocations
    • messages.getSearchCounters
    • messages.getUnreadMentions
    • messages.readHistory
    • messages.readMentions
    • messages.readMessageContents
    • messages.receivedMessages
    • messages.search
    • messages.searchGlobal
    • messages.sendMedia
    • messages.sendMessage
    • messages.sendMultiMedia
    • messages.unpinAllMessages
    • messages.updatePinnedMessage
  • Working with notification settings
    • account.getNotifyExceptions
    • account.getNotifySettings
    • account.registerDevice
    • account.resetNotifySettings
    • account.unregisterDevice
    • account.updateDeviceLocked
    • account.updateNotifySettings
  • Working with other users
    • users.getFullUser
    • users.getUsers
  • Working with payments
    • account.getTmpPassword
    • messages.setBotPrecheckoutResults
    • messages.setBotShippingResults
    • payments.clearSavedInfo
    • payments.getPaymentForm
    • payments.getPaymentReceipt
    • payments.getSavedInfo
    • payments.sendPaymentForm
    • payments.validateRequestedInfo
  • Working with polls
    • messages.getPollResults
    • messages.getPollVotes
    • messages.sendVote
  • Working with Public Service Announcement and MTProxy channels
    • help.getPromoData
    • help.hidePromoData
  • Working with scheduled messages
    • messages.deleteScheduledMessages
    • messages.getScheduledHistory
    • messages.getScheduledMessages
    • messages.sendScheduledMessages
  • Working with Seamless Telegram Login
    • account.getWebAuthorizations
    • account.resetWebAuthorization
    • account.resetWebAuthorizations
    • messages.acceptUrlAuth
    • messages.requestUrlAuth
  • Working with secret chats
    • messages.acceptEncryption
    • messages.discardEncryption
    • messages.getDhConfig
    • messages.readEncryptedHistory
    • messages.receivedQueue
    • messages.requestEncryption
    • messages.sendEncrypted
    • messages.sendEncryptedFile
    • messages.sendEncryptedService
    • messages.setEncryptedTyping
  • Working with sensitive content (NSFW)
    • account.getContentSettings
    • account.setContentSettings
  • Working with sponsored proxies
    • help.getProxyData
  • Working with stickers
    • messages.clearRecentStickers
    • messages.faveSticker
    • messages.getAllStickers
    • messages.getArchivedStickers
    • messages.getAttachedStickers
    • messages.getFavedStickers
    • messages.getFeaturedStickers
    • messages.getMaskStickers
    • messages.getOldFeaturedStickers
    • messages.getRecentStickers
    • messages.getStickers
    • messages.getStickerSet
    • messages.installStickerSet
    • messages.readFeaturedStickers
    • messages.reorderStickerSets
    • messages.saveRecentSticker
    • messages.searchStickerSets
    • messages.toggleStickerSets
    • messages.uninstallStickerSet
    • stickers.addStickerToSet
    • stickers.changeStickerPosition
    • stickers.createStickerSet
    • stickers.removeStickerFromSet
    • stickers.setStickerSetThumb
  • Working with telegram passport
    • account.acceptAuthorization
    • account.deleteSecureValue
    • account.getAllSecureValues
    • account.getAuthorizationForm
    • account.getAuthorizations
    • account.getSecureValue
    • account.saveSecureValue
    • account.sendVerifyEmailCode
    • account.sendVerifyPhoneCode
    • account.verifyEmail
    • account.verifyPhone
    • help.getPassportConfig
    • users.setSecureValueErrors
  • Working with the user's account
    • account.changePhone
    • account.confirmPhone
    • account.deleteAccount
    • account.getAccountTTL
    • account.getGlobalPrivacySettings
    • account.getPrivacy
    • account.resetAuthorization
    • account.sendChangePhoneCode
    • account.sendConfirmPhoneCode
    • account.setAccountTTL
    • account.setGlobalPrivacySettings
    • account.setPrivacy
    • account.updateProfile
    • account.updateStatus
  • Working with TSF (internal use only)
    • help.editUserInfo
    • help.getUserInfo
  • Working with updates
    • updates.getChannelDifference
    • updates.getDifference
    • updates.getState
  • Working with user profile pictures
    • photos.deletePhotos
    • photos.getUserPhotos
    • photos.updateProfilePhoto
    • photos.uploadProfilePhoto
  • Working with usernames
    • account.checkUsername
    • account.updateUsername
    • channels.checkUsername
    • channels.updateUsername
    • contacts.resolveUsername
  • Working with VoIP calls
    • phone.acceptCall
    • phone.confirmCall
    • phone.discardCall
    • phone.getCallConfig
    • phone.receivedCall
    • phone.requestCall
    • phone.saveCallDebug
    • phone.sendSignalingData
    • phone.setCallRating
  • Working with wallpapers
    • account.getMultiWallPapers
    • account.getWallPaper
    • account.getWallPapers
    • account.installWallPaper
    • account.resetWallPapers
    • account.saveWallPaper
    • account.uploadWallPaper
Powered by GitBook
On this page
  • Example
  • TL schema
  • Parameters
  • Result
  • Possible errors
  • Can bots use this methd ?
  • yes
  • Related pages

Was this helpful?

  1. Working with games

messages.setGameScore

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

Example

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.setGameScore({
        editMessage: true,
        force: true,
        peer: new Api.InputPeer({...}),
        id: 2819388,
        userId: new Api.InputUser({...}),
        score: 4871636,
        }));
    console.log(result); // prints the result
})();
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.Updates = await client.invoke(new Api.messages.setGameScore({
        editMessage: true,
        force: true,
        peer: new Api.InputPeer({...}),
        id: 2819388,
        userId: new Api.InputUser({...}),
        score: 4871636,
        }));
    console.log(result); // prints the result
})();

TL schema

updatesTooLong#e317af7e = Updates;
updateShortMessage#2296d2c8 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> = Updates;
updateShortChatMessage#402d5dbb flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> = Updates;
updateShort#78d4dec1 update:Update date:int = Updates;
updatesCombined#725b04c3 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq_start:int seq:int = Updates;
updates#74ae4240 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq:int = Updates;
updateShortSentMessage#11f1331c flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector<MessageEntity> = Updates;
---functions---
messages.setGameScore#8ef8ecc0 flags:# edit_message:flags.0?true force:flags.1?true peer:InputPeer id:int user_id:InputUser score:int = Updates;

Parameters

Name

Type

Description

flags

edit_message

Set this flag if the game message should be automatically edited to include the current scoreboard

force

Set this flag if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters

peer

Unique identifier of target chat

id

Identifier of the sent message

user_id

User identifier

score

New score

Result

Possible errors

Code

Type

Description

400

MESSAGE_ID_INVALID

The provided message id is invalid

400

PEER_ID_INVALID

The provided peer id is invalid

400

USER_BOT_REQUIRED

This method can only be called by a bot

Can bots use this methd ?

yes

Related pages

Previousmessages.getInlineGameHighScoresNextmessages.setInlineGameScore

Last updated 4 years ago

Was this helpful?

Flags, see

.0?

.1?

Updates
#
TL conditional fields
flags
true
flags
true
InputPeer
int
InputUser
int