Implementation von Callback-Querys (auf ein neues!)

This commit is contained in:
Andreas Bielawski
2016-07-02 12:35:14 +02:00
parent 52e0ea8125
commit 862335dc77
3 changed files with 82 additions and 27 deletions

View File

@@ -52,11 +52,12 @@ end
-- NOTE: Telegram currently only allows file uploads up to 50 MB
-- https://core.telegram.org/bots/api#sendphoto
function utilities:send_photo(chat_id, file, text, reply_to_message_id)
function utilities:send_photo(chat_id, file, text, reply_to_message_id, reply_markup)
local output = bindings.request(self, 'sendPhoto', {
chat_id = chat_id,
caption = text or nil,
reply_to_message_id = reply_to_message_id
reply_to_message_id = reply_to_message_id,
reply_markup = reply_markup
}, {photo = file} )
os.remove(file)
print("Deleted: "..file)
@@ -78,11 +79,12 @@ function utilities:send_audio(chat_id, file, reply_to_message_id, duration, perf
end
-- https://core.telegram.org/bots/api#senddocument
function utilities:send_document(chat_id, file, text, reply_to_message_id)
function utilities:send_document(chat_id, file, text, reply_to_message_id, reply_markup)
local output = bindings.request(self, 'sendDocument', {
chat_id = chat_id,
caption = text or nil,
reply_to_message_id = reply_to_message_id
reply_to_message_id = reply_to_message_id,
reply_markup = reply_markup
}, {document = file} )
os.remove(file)
print("Deleted: "..file)
@@ -149,6 +151,15 @@ function utilities:send_typing(chat_id, action)
} )
end
-- https://core.telegram.org/bots/api#answercallbackquery
function utilities:answer_callback_query(callback, text, show_alert)
return bindings.request(self, 'answerCallbackQuery', {
callback_query_id = callback.id,
text = text,
show_alert = show_alert
} )
end
-- get the indexed word in a string
function utilities.get_word(s, i)
s = s or ''
@@ -775,4 +786,4 @@ function url_encode(str)
return str
end
return utilities
return utilities