-
Notifications
You must be signed in to change notification settings - Fork 21
sendDocument
Sahri Riza Umami edited this page Jun 12, 2018
·
3 revisions
Sends a document (general file) message.
sendDocument(chat_id, reply_to_message_id, document, caption, parse_mode, thumbnail, thumb_width, thumb_height, disable_notification, from_background, reply_markup, callback, data)
Field | Type | Description |
---|---|---|
chat_id |
int53 | Chat to send message. |
reply_to_message_id |
int53 | Identifier of a message to reply to. |
document |
inputFile | Document to be sent. The file can be defined by its unique ids, remote ids, local path or generated by client. |
caption |
string | Document caption; 0-200 characters. |
parse_mode |
string | Text parse mode. |
thumbnail |
inputThumb | Document thumbnail, if available. |
thumb_width |
int32 | Thumbnail width, usually shouldn't exceed 90. Use 0 if unknown. |
thumb_height |
int32 | Thumbnail height, usually shouldn't exceed 90. Use 0 if unknown. |
disable_notification |
Bool | Pass true, to disable notification about the message, doesn't works in secret chats |
from_background |
Bool | Pass true, if the message is sent from background |
reply_markup |
ReplyMarkup | Bots only. Markup for replying to message |
-
Send a document from local path into chat
1234567890
. And add "Important" string in bold as its caption.sendDocument(1234567890, msg.id, '/tmp/script.lua', '*Important*', 'md')
Response:
{ ["@type"] = "message", author_signature = "", can_be_deleted_for_all_users = true, can_be_deleted_only_for_self = false, can_be_edited = false, can_be_forwarded = true, chat_id = "1234567890", contains_unread_mention = false, content = { ["@type"] = "messageDocument", caption = { ["@type"] = "formattedText", entities = { { ["@type"] = "textEntity", length = 9, offset = 0, type = { ["@type"] = "textEntityTypeBold" } } }, text = "Important" }, document = { ["@type"] = "document", document = { ["@type"] = "file", expected_size = 3310, id = 6, ["local"] = { ["@type"] = "localFile", can_be_deleted = false, can_be_downloaded = false, downloaded_prefix_size = 3310, downloaded_size = 3310, is_downloading_active = false, is_downloading_completed = true, path = "/tmp/script.lua" }, remote = { ["@type"] = "remoteFile", id = "", is_uploading_active = true, is_uploading_completed = false, uploaded_size = 0 }, size = 3310 }, file_name = "script.lua", mime_type = "" } }, date = 1528825619, edit_date = 0, id = "15961423881", is_channel_post = false, is_outgoing = true, media_album_id = "0", reply_to_message_id = "15961423872", sender_user_id = 111112251, sending_state = { ["@type"] = "messageSendingStatePending" }, ttl = 0, ttl_expires_in = 0, via_bot_user_id = 0, views = 0 }
Frequently Asked Questions
The Functions
- getAuthorizationState
- setTdlibParameters
- checkDatabaseEncryptionKey
- setAuthenticationPhoneNumber
- resendAuthenticationCode
- checkAuthenticationCode
- checkAuthenticationPassword
- requestAuthenticationPasswordRecovery
- recoverAuthenticationPassword
- checkAuthenticationBotToken
- logOut
- close
- destroy
- setDatabaseEncryptionKey
- getPasswordState
- setPassword
- getRecoveryEmailAddress
- setRecoveryEmailAddress
- requestPasswordRecovery
- recoverPassword
- createTemporaryPassword
- getTemporaryPasswordState
- processDcUpdate
- getMe
- getUser
- getUserFullInfo
- getBasicGroup
- getBasicGroupFullInfo
- getSupergroup
- getSupergroupFullInfo
- getSecretChat
- getChat
- getMessage
- getRepliedMessage
- getChatPinnedMessage
- getMessages
- getFile
- getRemoteFile
- getChats
- searchPublicChat
- searchPublicChats
- searchChats
- searchChatsOnServer
- getTopChats
- removeTopChat
- addRecentlyFoundChat
- removeRecentlyFoundChat
- clearRecentlyFoundChats
- checkChatUsername
- getCreatedPublicChats
- getGroupsInCommon
- getChatHistory
- deleteChatHistory
- searchChatMessages
- searchMessages
- searchSecretMessages
- searchCallMessages
- searchChatRecentLocationMessages
- getActiveLiveLocationMessages
- getChatMessageByDate
- getPublicMessageLink
- sendMessage
- sendMessageAlbum
- sendBotStartMessage
- sendInlineQueryResultMessage
- forwardMessages
- sendChatSetTtlMessage
- sendChatScreenshotTakenNotification
- deleteMessages
- deleteChatMessagesFromUser
- editMessageText
- editMessageLiveLocation
- editMessageCaption
- editMessageReplyMarkup
- editInlineMessageText
- editInlineMessageLiveLocation
- editInlineMessageCaption
- editInlineMessageReplyMarkup
- getTextEntities
- parseTextEntities
- getFileMimeType
- getFileExtension
- getInlineQueryResults
- answerInlineQuery
- getCallbackQueryAnswer
- answerCallbackQuery
- answerShippingQuery
- answerPreCheckoutQuery
- setGameScore
- setInlineGameScore
- getGameHighScores
- getInlineGameHighScores
- deleteChatReplyMarkup
- sendChatAction
- openChat
- closeChat
- viewMessages
- openMessageContent
- readAllChatMentions
- createPrivateChat
- createBasicGroupChat
- createSupergroupChat
- createSecretChat
- createNewBasicGroupChat
- createNewSupergroupChat
- createNewSecretChat
- upgradeBasicGroupChatToSupergroupChat
- setChatTitle
- setChatPhoto
- setChatDraftMessage
- toggleChatIsPinned
- setChatClientData
- addChatMember
- addChatMembers
- setChatMemberStatus
- getChatMember
- searchChatMembers
- getChatAdministrators
- setPinnedChats
- downloadFile
- cancelDownloadFile
- uploadFile
- cancelUploadFile
- setFileGenerationProgress
- finishFileGeneration
- deleteFile
- generateChatInviteLink
- checkChatInviteLink
- joinChatByInviteLink
- createCall
- acceptCall
- discardCall
- sendCallRating
- sendCallDebugInformation
- blockUser
- unblockUser
- getBlockedUsers
- importContacts
- searchContacts
- removeContacts
- getImportedContactCount
- changeImportedContacts
- clearImportedContacts
- getUserProfilePhotos
- getStickers
- searchStickers
- getInstalledStickerSets
- getArchivedStickerSets
- getTrendingStickerSets
- getAttachedStickerSets
- getStickerSet
- searchStickerSet
- searchInstalledStickerSets
- searchStickerSets
- changeStickerSet
- viewTrendingStickerSets
- reorderInstalledStickerSets
- getRecentStickers
- addRecentSticker
- removeRecentSticker
- clearRecentStickers
- getFavoriteStickers
- addFavoriteSticker
- removeFavoriteSticker
- getStickerEmojis
- getSavedAnimations
- addSavedAnimation
- removeSavedAnimation
- getRecentInlineBots
- searchHashtags
- removeRecentHashtag
- getWebPagePreview
- getWebPageInstantView
- getNotificationSettings
- setNotificationSettings
- setNotificationSettings
- resetAllNotificationSettings
- setProfilePhoto
- deleteProfilePhoto
- setName
- setBio
- setUsername
- changePhoneNumber
- resendChangePhoneNumberCode
- checkChangePhoneNumberCode
- getActiveSessions
- terminateSession
- terminateAllOtherSessions
- getConnectedWebsites
- disconnectWebsite
- disconnectAllWebsites
- toggleBasicGroupAdministrators
- setSupergroupUsername
- setSupergroupStickerSet
- toggleSupergroupInvites
- toggleSupergroupSignMessages
- toggleSupergroupIsAllHistoryAvailable
- setSupergroupDescription
- pinSupergroupMessage
- unpinSupergroupMessage
- reportSupergroupSpam
- getSupergroupMembers
- deleteSupergroup
- closeSecretChat
- getChatEventLog
- getPaymentForm
- validateOrderInfo
- sendPaymentForm
- getPaymentReceipt
- getSavedOrderInfo
- deleteSavedOrderInfo
- deleteSavedCredentials
- getSupportUser
- getWallpapers
- registerDevice
- getRecentlyVisitedTMeUrls
- setUserPrivacySettingRules
- getUserPrivacySettingRules
- getOption
- setOption
- setAccountTtl
- getAccountTtl
- deleteAccount
- getChatReportSpamState
- changeChatReportSpamState
- reportChat
- getStorageStatistics
- getStorageStatisticsFast
- optimizeStorage
- setNetworkType
- getNetworkStatistics
- addNetworkStatistics
- resetNetworkStatistics
- setBotUpdatesStatus
- uploadStickerFile
- createNewStickerSet
- addStickerToSet
- setStickerPositionInSet
- removeStickerFromSet
- sendCustomRequest
- answerCustomQuery
- setAlarm
- getCountryCode
- getInviteText
- getTermsOfService
- setProxy
- getProxy
- testCallEmpty
- testCallString
- testCallBytes
- testCallVectorInt
- testCallVectorIntObject
- testCallVectorString
- testCallVectorStringObject
- testSquareInt
- testNetwork
- testGetDifference
- testUseUpdate
- testUseError
- sendText
- sendAnimation
- sendAudio
- sendDocument
- sendPhoto
- sendSticker
- sendVideo
- sendVideoNote
- sendVoiceNote
- sendLocation
- sendVenue
- sendContact
- sendGame
- sendInvoice
- sendForwarded