Skip to content

Commit 7dd74aa

Browse files
committed
add missing fields to answerInlineQuery
1 parent ff52679 commit 7dd74aa

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

telebot.nimble

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "0.5.6.1"
1+
version = "0.5.6.2"
22
author = "Huy Doan"
33
description = "Async Telegram Bot API Client"
44
license = "MIT"

telebot/api.nim

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ proc setChatPhoto*(b: TeleBot, chatId: string, photo: string): Future[bool] {.as
259259
END_POINT("setChatPhoto")
260260
var data = newMultipartData()
261261
data["chat_id"] = chatId
262-
data.addFiles({"name": "photo", "file": photo.string})
262+
data.addFiles({"name": "photo", "file": photo})
263263
let res = await makeRequest(endpoint % b.token, data)
264264
result = res.bval
265265

@@ -353,7 +353,7 @@ proc uploadStickerFile*(b: TeleBot, userId: int, pngSticker: string): Future[typ
353353
END_POINT("uploadStickerFile")
354354
var data = newMultipartData()
355355
data["user_id"] = $userId
356-
data.addFiles({"name": "png_sticker", "file": pngSticker.string})
356+
data.addFiles({"name": "png_sticker", "file": pngSticker})
357357
let res = await makeRequest(endpoint % b.token, data)
358358
result = unmarshal(res, types.File)
359359

@@ -581,7 +581,6 @@ proc answerCallbackQuery*(b: TeleBot, callbackQueryId: string, text = "", showAl
581581

582582
proc answerInlineQuery*[T](b: TeleBot, id: string, results: seq[T], cacheTime = 0, isPersonal = false, nextOffset = "", switchPmText = "", switchPmParameter = ""): Future[bool] {.async.} =
583583
const endpoint = API_URL & "answerInlineQuery"
584-
585584
if results.len == 0:
586585
return false
587586

@@ -592,6 +591,16 @@ proc answerInlineQuery*[T](b: TeleBot, id: string, results: seq[T], cacheTime =
592591
marshal(results, s)
593592
d("results", s)
594593
data["results"] = s
594+
if cacheTime != 0:
595+
data["cache_time"] = $cacheTime
596+
if isPersonal:
597+
data["is_personal"] = true
598+
if nextOffset.len > 0:
599+
data["next_offset"] = nextOffset
600+
if switchPmText.len > 0:
601+
data["switch_pm_text"] = switchPmText
602+
if switchPmParameter.len > 0:
603+
data["switch_pm_parameter"] = switchPmParameter
595604

596605
let res = await makeRequest(endpoint % b.token, data)
597606
result = res.bval

0 commit comments

Comments
 (0)