tdbot.lua
tdbot.lua copied to clipboard
Lua wrapper for telegram-bot
tdbot.lua
A simple Lua wrapper for tdbot.
See wiki for documentation.
How to Use
- Put
tdbot.luaon a same directory level with the bot script - Import
tdbot.luainto the bot. - Call the functions.
See example script below.
-- Load tdbot library.
local tdbot = require 'tdbot'
function tdbot_update_callback (data)
if (data["@type"] == "updateNewMessage") then
local msg = data.message
if msg.content["@type"] == "messageText" then
if msg.content.text.text == "ping" then
tdbot.sendText(msg.chat_id, msg.id, '<b>pong!</b>', 'html')
end
end
end
end
The Functions
tdbot.lua is a Work In Progress. This commit is based on:
tdbotcommit https://github.com/vysheng/tdbot/commit/a838e8768f1c405306975763d59d48ca9f347805td_api.tlfromtdcommit https://github.com/tdlib/td/commit/cfe4d9bdcee9305632eb228a46a95407d05b5c7a
Here is a list of tdbot methods. Checked functions has been tested and works or at least returned "ok".
- [x] getAuthorizationState
- [ ] setTdlibParameters
- [ ] checkDatabaseEncryptionKey
- [ ] setAuthenticationPhoneNumber
- [x] resendAuthenticationCode
- [ ] checkAuthenticationCode
- [ ] checkAuthenticationPassword
- [ ] requestAuthenticationPasswordRecovery
- [ ] recoverAuthenticationPassword
- [x] checkAuthenticationBotToken
- [x] logOut
- [x] close
- [x] destroy
- [ ] setDatabaseEncryptionKey
- [x] getPasswordState
- [x] setPassword
- [x] getRecoveryEmailAddress
- [x] setRecoveryEmailAddress
- [x] requestPasswordRecovery
- [x] recoverPassword
- [x] createTemporaryPassword
- [x] getTemporaryPasswordState
- [ ] processDcUpdate
- [x] getMe
- [x] getUser
- [x] getUserFullInfo
- [x] getBasicGroup
- [x] getBasicGroupFullInfo
- [x] getSupergroup
- [x] getSupergroupFullInfo
- [x] getSecretChat
- [x] getChat
- [x] getMessage
- [x] getRepliedMessage
- [x] getChatPinnedMessage
- [x] getMessages
- [x] getFile
- [x] getRemoteFile
- [x] getChats
- [x] searchPublicChat
- [x] searchPublicChats
- [x] searchChats
- [x] searchChatsOnServer
- [x] getTopChats
- [x] removeTopChat
- [x] addRecentlyFoundChat
- [x] removeRecentlyFoundChat
- [x] clearRecentlyFoundChats
- [x] checkChatUsername
- [x] getCreatedPublicChats
- [x] getGroupsInCommon
- [x] getChatHistory
- [x] deleteChatHistory
- [x] searchChatMessages
- [x] searchMessages
- [x] searchSecretMessages
- [x] searchCallMessages
- [ ] searchChatRecentLocationMessages
- [ ] getActiveLiveLocationMessages
- [x] getChatMessageByDate
- [x] getPublicMessageLink
- [x] sendMessage
- [x] sendMessageAlbum
- [x] sendBotStartMessage
- [x] sendInlineQueryResultMessage
- [x] forwardMessages
- [x] sendChatSetTtlMessage
- [x] sendChatScreenshotTakenNotification
- [x] deleteMessages
- [x] deleteChatMessagesFromUser
- [x] editMessageText
- [ ] editMessageLiveLocation
- [x] editMessageCaption
- [ ] editMessageReplyMarkup
- [ ] editInlineMessageText
- [ ] editInlineMessageLiveLocation
- [ ] editInlineMessageCaption
- [ ] editInlineMessageReplyMarkup
- [x] getTextEntities
- [x] parseTextEntities
- [x] getFileMimeType
- [x] getFileExtension
- [x] getInlineQueryResults
- [ ] answerInlineQuery
- [x] getCallbackQueryAnswer
- [ ] answerCallbackQuery
- [ ] answerShippingQuery
- [ ] answerPreCheckoutQuery
- [ ] setGameScore
- [ ] setInlineGameScore
- [ ] getGameHighScores
- [ ] getInlineGameHighScores
- [x] deleteChatReplyMarkup
- [x] sendChatAction
- [x] openChat
- [x] closeChat
- [x] viewMessages
- [x] openMessageContent
- [x] readAllChatMentions
- [x] createPrivateChat
- [x] createBasicGroupChat
- [x] createSupergroupChat
- [x] createSecretChat
- [x] createNewBasicGroupChat
- [x] createNewSupergroupChat
- [x] createNewSecretChat
- [x] upgradeBasicGroupChatToSupergroupChat
- [x] setChatTitle
- [x] setChatPhoto
- [x] setChatDraftMessage
- [x] toggleChatIsPinned
- [x] setChatClientData
- [x] addChatMember
- [x] addChatMembers
- [x] setChatMemberStatus
- [x] getChatMember
- [x] searchChatMembers
- [x] getChatAdministrators
- [x] setPinnedChats
- [x] downloadFile
- [x] cancelDownloadFile
- [x] uploadFile
- [x] cancelUploadFile
- [ ] setFileGenerationProgress
- [ ] finishFileGeneration
- [x] deleteFile
- [x] generateChatInviteLink
- [x] checkChatInviteLink
- [x] joinChatByInviteLink
- [x] createCall
- [x] acceptCall
- [x] discardCall
- [ ] sendCallRating
- [ ] sendCallDebugInformation
- [x] blockUser
- [x] unblockUser
- [x] getBlockedUsers
- [x] importContacts
- [x] searchContacts
- [x] removeContacts
- [x] getImportedContactCount
- [x] changeImportedContacts
- [x] clearImportedContacts
- [x] getUserProfilePhotos
- [x] getStickers
- [x] searchStickers
- [x] getInstalledStickerSets
- [x] getArchivedStickerSets
- [x] getTrendingStickerSets
- [x] getAttachedStickerSets
- [x] getStickerSet
- [x] searchStickerSet
- [x] searchInstalledStickerSets
- [x] searchStickerSets
- [x] changeStickerSet
- [x] viewTrendingStickerSets
- [x] reorderInstalledStickerSets
- [x] getRecentStickers
- [x] addRecentSticker
- [x] removeRecentSticker
- [x] clearRecentStickers
- [x] getFavoriteStickers
- [x] addFavoriteSticker
- [x] removeFavoriteSticker
- [x] getStickerEmojis
- [x] getSavedAnimations
- [x] addSavedAnimation
- [x] removeSavedAnimation
- [x] getRecentInlineBots
- [x] searchHashtags
- [x] removeRecentHashtag
- [x] getWebPagePreview
- [x] getWebPageInstantView
- [x] getNotificationSettings
- [x] setNotificationSettings
- [x] setNotificationSettings
- [x] resetAllNotificationSettings
- [x] setProfilePhoto
- [x] deleteProfilePhoto
- [x] setName
- [x] setBio
- [x] setUsername
- [ ] changePhoneNumber
- [ ] resendChangePhoneNumberCode
- [ ] checkChangePhoneNumberCode
- [x] getActiveSessions
- [x] terminateSession
- [x] terminateAllOtherSessions
- [x] getConnectedWebsites
- [ ] disconnectWebsite
- [ ] disconnectAllWebsites
- [x] toggleBasicGroupAdministrators
- [x] setSupergroupUsername
- [x] setSupergroupStickerSet
- [x] toggleSupergroupInvites
- [x] toggleSupergroupSignMessages
- [x] toggleSupergroupIsAllHistoryAvailable
- [x] setSupergroupDescription
- [x] pinSupergroupMessage
- [x] unpinSupergroupMessage
- [x] reportSupergroupSpam
- [x] getSupergroupMembers
- [x] deleteSupergroup
- [x] closeSecretChat
- [x] getChatEventLog
- [ ] getPaymentForm
- [ ] validateOrderInfo
- [ ] sendPaymentForm
- [ ] getPaymentReceipt
- [x] getSavedOrderInfo
- [x] deleteSavedOrderInfo
- [x] deleteSavedCredentials
- [x] getSupportUser
- [x] getWallpapers
- [ ] registerDevice
- [ ] getRecentlyVisitedTMeUrls
- [x] setUserPrivacySettingRules
- [x] getUserPrivacySettingRules
- [x] getOption
- [x] setOption
- [x] setAccountTtl
- [x] getAccountTtl
- [x] deleteAccount
- [x] getChatReportSpamState
- [ ] changeChatReportSpamState
- [x] reportChat
- [x] getStorageStatistics
- [x] getStorageStatisticsFast
- [x] optimizeStorage
- [x] setNetworkType
- [x] getNetworkStatistics
- [x] addNetworkStatistics
- [x] resetNetworkStatistics
- [ ] setBotUpdatesStatus
- [ ] uploadStickerFile
- [ ] createNewStickerSet
- [ ] addStickerToSet
- [ ] setStickerPositionInSet
- [ ] removeStickerFromSet
- [ ] sendCustomRequest
- [ ] answerCustomQuery
- [x] setAlarm
- [x] getCountryCode
- [x] getInviteText
- [x] getTermsOfService
- [ ] setProxy
- [x] getProxy
- [ ] testCallEmpty
- [ ] testCallString
- [ ] testCallBytes
- [ ] testCallVectorInt
- [ ] testCallVectorIntObject
- [ ] testCallVectorString
- [ ] testCallVectorStringObject
- [ ] testSquareInt
- [ ] testNetwork
- [ ] testGetDifference
- [ ] testUseUpdate
- [ ] testUseError
- [x] sendText
- [x] sendAnimation
- [x] sendAudio
- [x] sendDocument
- [x] sendPhoto
- [x] sendSticker
- [x] sendVideo
- [x] sendVideoNote
- [x] sendVoiceNote
- [x] sendLocation
- [x] sendVenue
- [x] sendContact
- [x] sendGame
- [ ] sendInvoice
- [x] sendForwarded