-
Notifications
You must be signed in to change notification settings - Fork 29
Frequently Asked Questions
Sahri Riza Umami edited this page Jan 13, 2017
·
8 revisions
Why I always get 1484111513.000000 lua: attempt to call a nil value
? The number always different and the functions are works.
You're missing a global callback function.
Please create a global callback function on your script, even if it's just an empty one.
Example, for a getMessage
function and its patternsByReply
custom callback:
tdcli.getMessage(msg.chat_id_, msg.reply_to_message_id_, patternsByReply, {
chat_id = msg.chat_id_,
text = msg.content_.text_
})
Create a global callback function:
function patternsByReply(arg, data)
end
tdcli.lua
meant to be a universal library. So, every parameter counts.
Just create a custom function as an alias to make it shorter and more fitted to your script.
Example, this is a default to send a text message:
tdcli.sendText(msg.chat_id_, msg.id_, 0, 1, nil, text, 1, 'HTML', dl_cb, cmd)
But, you're rarely use parameters other than chat_id
, msg_id
, and text
. Create a function like this:
function sendText(chat_id, reply_to_message_id, text, disable_web_page_preview, parse_mode)
local parse_mode = parse_mode or 'HTML'
local disable_web_page_preview = disable_web_page_preview or 1
tdcli.sendText(chat_id, reply_to_message_id, 0, 1, nil, text, disable_web_page_preview, parse_mode)
end
So, next time you need to send a text message, you just need to type:
sendText(msg.chat_id_, msg.id_, "Hi, it's me")
Test script
Frequently Asked Questions
The Functions
- getAuthState
- setAuthPhoneNumber
- resendAuthCode
- checkAuthCode
- checkAuthPassword
- requestAuthPasswordRecovery
- recoverAuthPassword
- resetAuth
- checkAuthBotToken
- getPasswordState
- setPassword
- getRecoveryEmail
- setRecoveryEmail
- requestPasswordRecovery
- recoverPassword
- getMe
- getUser
- getUserFull
- getGroup
- getGroupFull
- getChannel
- getChannelFull
- getSecretChat
- getChat
- getMessage
- getMessages
- getFile
- getFilePersistent
- getChats
- searchPublicChat
- searchPublicChats
- searchChats
- addRecentlyFoundChat
- deleteRecentlyFoundChat
- deleteRecentlyFoundChats
- getCommonChats
- getChatHistory
- deleteChatHistory
- searchChatMessages
- searchMessages
- sendBotStartMessage
- sendInlineQueryResultMessage
- forwardMessages
- sendChatSetTtlMessage
- deleteMessages
- deleteMessagesFromUser
- editMessageText
- editMessageCaption
- editMessageReplyMarkup
- editInlineMessageText
- editInlineMessageCaption
- editInlineMessageReplyMarkup
- getInlineQueryResults
- answerInlineQuery
- getCallbackQueryAnswer
- answerCallbackQuery
- setGameScore
- setInlineGameScore
- getGameHighScores
- getInlineGameHighScores
- deleteChatReplyMarkup
- sendChatAction
- sendChatScreenshotTakenNotification
- openChat
- closeChat
- viewMessages
- openMessageContent
- createPrivateChat
- createGroupChat
- createChannelChat
- createSecretChat
- createNewGroupChat
- createNewChannelChat
- createNewSecretChat
- migrateGroupChatToChannelChat
- changeChatTitle
- changeChatPhoto
- changeChatDraftMessage
- addChatMember
- addChatMembers
- changeChatMemberStatus
- getChatMember
- downloadFile
- cancelDownloadFile
- setFileGenerationProgress
- finishFileGeneration
- exportChatInviteLink
- checkChatInviteLink
- importChatInviteLink
- blockUser
- unblockUser
- getBlockedUsers
- importContacts
- searchContacts
- deleteContacts
- getUserProfilePhotos
- getStickers
- getStickerSets
- getArchivedStickerSets
- getTrendingStickerSets
- getAttachedStickerSets
- getStickerSet
- searchStickerSet
- updateStickerSet
- viewTrendingStickerSets
- reorderStickerSets
- getRecentStickers
- addRecentSticker
- deleteRecentSticker
- clearRecentStickers
- getStickerEmojis
- getSavedAnimations
- addSavedAnimation
- deleteSavedAnimation
- getRecentInlineBots
- getWebPagePreview
- getNotificationSettings
- setNotificationSettings
- resetAllNotificationSettings
- setProfilePhoto
- deleteProfilePhoto
- changeName
- changeAbout
- changeUsername
- changePhoneNumber
- resendChangePhoneNumberCode
- checkChangePhoneNumberCode
- getActiveSessions
- terminateSession
- terminateAllOtherSessions
- toggleGroupEditors
- changeChannelUsername
- toggleChannelInvites
- toggleChannelSignMessages
- changeChannelAbout
- pinChannelMessage
- unpinChannelMessage
- reportChannelSpam
- getChannelMembers
- deleteChannel
- getCreatedPublicChannels
- closeSecretChat
- getSupportUser
- getWallpapers
- registerDevice
- getDeviceTokens
- setPrivacy
- getPrivacy
- getOption
- setOption
- changeAccountTtl
- getAccountTtl
- deleteAccount
- getChatReportSpamState
- changeChatReportSpamState
- setBotUpdatesStatus
- setAlarm
- sendText
- sendAnimation
- sendAudio
- sendDocument
- sendPhoto
- sendSticker
- sendVideo
- sendVoice
- sendLocation
- sendVenue
- sendContact
- sendGame
- sendForwarded