A simple Lua wrapper for telegram-bot
.
See wiki for documentation.
- Put
tdbot.lua
on a same directory level with your bot script - Import
tdbot.lua
into your bot. - Call the functions.
See example script below.
-- Load tdbot library.
tdbot = require 'tdbot'
-- An alias to sendText
function sendText(chat_id, reply_to_message_id, text)
tdbot.sendText(chat_id, reply_to_message_id, text, 0, 1, nil, 1, 'html', 0, nil)
end
function tdbot_update_callback (data)
if (data._ == "updateNewMessage") then
local msg = data.message
if msg.content._ == "messageText" then
if msg.content.text == "ping" then
sendText(chat_id, msg.id, '<b>pong!</b>')
}, dl_cb, nil))
end
end
end
end
tdbot.lua
is a Work In Progress. This commit is based on telegram-bot-171023-nightly.tl scheme.
Here is a list of telegram-bot
methods. Checked functions has been tested and works or returned "ok".
- getAuthState
- setAuthPhoneNumber
- resendAuthCode
- checkAuthCode
- checkAuthPassword
- requestAuthPasswordRecovery
- recoverAuthPassword
- resetAuth
- checkAuthBotToken
- getPasswordState
- setPassword
- getRecoveryEmail
- setRecoveryEmail
- requestPasswordRecovery
- recoverPassword
- createTemporaryPassword
- getTemporaryPasswordState
- processDcUpdate
- getMe
- getUser
- getUserFull
- getGroup
- getGroupFull
- getChannel
- getChannelFull
- getSecretChat
- getChat
- getMessage
- getMessages
- getFile
- getFilePersistent
- getChats
- searchPublicChat
- searchPublicChats
- searchChats
- getTopChats
- deleteTopChat
- addRecentlyFoundChat
- deleteRecentlyFoundChat
- deleteRecentlyFoundChats
- getCommonChats
- getCreatedPublicChats
- getChatHistory
- deleteChatHistory
- searchChatMessages
- searchMessages
- searchSecretMessages
- searchCallMessages
- getPublicMessageLink
- sendMessage
- sendBotStartMessage
- sendInlineQueryResultMessage
- forwardMessages
- sendChatSetTtlMessage
- sendChatScreenshotTakenNotification
- deleteMessages
- deleteMessagesFromUser
- editMessageText
- editMessageCaption
- editMessageReplyMarkup
- editInlineMessageText
- editInlineMessageCaption
- editInlineMessageReplyMarkup
- getTextEntities
- getFileMimeType
- getFileExtension
- getInlineQueryResults
- answerInlineQuery
- getCallbackQueryAnswer
- answerCallbackQuery
- answerShippingQuery
- answerPreCheckoutQuery
- setGameScore
- setInlineGameScore
- getGameHighScores
- getInlineGameHighScores
- deleteChatReplyMarkup
- sendChatAction
- openChat
- closeChat
- viewMessages
- openMessageContent
- createPrivateChat
- createGroupChat
- createChannelChat
- createSecretChat
- createNewGroupChat
- createNewChannelChat
- createNewSecretChat
- migrateGroupChatToChannelChat
- changeChatTitle
- changeChatPhoto
- changeChatDraftMessage
- toggleChatIsPinned
- setChatClientData
- addChatMember
- addChatMembers
- changeChatMemberStatus
- getChatMember
- searchChatMembers
- setPinnedChats
- downloadFile
- cancelDownloadFile
- uploadFile
- cancelUploadFile
- setFileGenerationProgress
- finishFileGeneration
- deleteFile
- exportChatInviteLink
- checkChatInviteLink
- importChatInviteLink
- createCall
- acceptCall
- discardCall
- rateCall
- debugCall
- blockUser
- unblockUser
- getBlockedUsers
- importContacts
- searchContacts
- deleteContacts
- getImportedContactCount
- deleteImportedContacts
- getUserProfilePhotos
- getStickers
- getInstalledStickerSets
- getArchivedStickerSets
- getTrendingStickerSets
- getAttachedStickerSets
- getStickerSet
- searchStickerSet
- changeStickerSet
- viewTrendingStickerSets
- reorderInstalledStickerSets
- getRecentStickers
- addRecentSticker
- deleteRecentSticker
- clearRecentStickers
- getFavoriteStickers
- addFavoriteSticker
- deleteFavoriteSticker
- getStickerEmojis
- getSavedAnimations
- addSavedAnimation
- deleteSavedAnimation
- getRecentInlineBots
- searchHashtags
- deleteRecentHashtag
- getWebPagePreview
- getWebPageInstantView
- getNotificationSettings
- setNotificationSettings
- resetAllNotificationSettings
- setProfilePhoto
- deleteProfilePhoto
- changeName
- changeAbout
- changeUsername
- changePhoneNumber
- resendChangePhoneNumberCode
- checkChangePhoneNumberCode
- getActiveSessions
- terminateSession
- terminateAllOtherSessions
- toggleGroupAdministrators
- changeChannelUsername
- setChannelStickerSet
- toggleChannelInvites
- toggleChannelSignMessages
- changeChannelDescription
- pinChannelMessage
- unpinChannelMessage
- reportChannelSpam
- getChannelMembers
- deleteChannel
- closeSecretChat
- getChatEventLog
- getPaymentForm
- validateOrderInfo
- sendPaymentForm
- getPaymentReceipt
- getSavedOrderInfo
- deleteSavedOrderInfo
- deleteSavedCredentials
- getSupportUser
- getWallpapers
- registerDevice
- setPrivacy
- getPrivacy
- getOption
- setOption
- changeAccountTtl
- getAccountTtl
- deleteAccount
- getChatReportSpamState
- changeChatReportSpamState
- reportChat
- getStorageStatistics
- getStorageStatisticsFast
- optimizeStorage
- setNetworkType
- getNetworkStatistics
- addNetworkStatistics
- resetNetworkStatistics
- setBotUpdatesStatus
- uploadStickerFile
- createNewStickerSet
- addStickerToSet
- setStickerPositionInSet
- deleteStickerFromSet
- sendCustomRequest
- answerCustomQuery
- setAlarm
- getInviteText
- getTermsOfService
- setProxy
- getProxy
- testCallEmpty
- testCallString
- testCallBytes
- testCallVectorInt
- testCallVectorIntObject
- testCallVectorString
- testCallVectorStringObject
- testSquareInt
- testNetwork
- testGetDifference
- testUseUpdate
- testUseError
- sendText
- sendAnimation
- sendAudio
- sendDocument
- sendPhoto
- sendSticker
- sendVideo
- sendVideoNote
- sendVoice
- sendLocation
- sendVenue
- sendContact
- sendGame
- sendInvoice
- sendForwarded