@@ -331,7 +331,8 @@ proc sendAnimation*(b: TeleBot, chatId: int64, animation: string, duration = 0,
331
331
result = getMessage(res)
332
332
333
333
proc sendPoll* (b: TeleBot, chatId: int64 , question: string , options: seq [string ], isAnonymous = false , kind = " " ,
334
- allowsMultipleAnswers = false , correctOptionId = 0 , isClosed = false ,
334
+ allowsMultipleAnswers = false , correctOptionId = 0 , explanation = " " , explanationParseMode = " " ,
335
+ openPeriod = 0 , closeDate = 0 , isClosed = false ,
335
336
disableNotification = false , replyToMessageId = 0 , replyMarkup: KeyboardMarkup = nil ): Future[Message] {.async.} =
336
337
END_POINT(" sendPoll" )
337
338
var data = newMultipartData()
@@ -347,6 +348,14 @@ proc sendPoll*(b: TeleBot, chatId: int64, question: string, options: seq[string]
347
348
data[" allows_multiple_answers" ] = " true"
348
349
if correctOptionId != 0 :
349
350
data[" correct_option_id" ] = $ correctOptionId
351
+ if explanation.len != 0 :
352
+ data[" explanation" ] = explanation
353
+ if explanationParseMode.len != 0 :
354
+ data[" explanation_parse_mode" ] = explanationParseMode
355
+ if openPeriod != 0 :
356
+ data[" open_period" ] = $ openPeriod
357
+ if closeDate != 0 :
358
+ data[" close_date" ] = $ closeDate
350
359
if isClosed:
351
360
data[" is_closed" ] = " true"
352
361
if disableNotification:
@@ -359,11 +368,13 @@ proc sendPoll*(b: TeleBot, chatId: int64, question: string, options: seq[string]
359
368
let res = await makeRequest(b, endpoint % b.token, data)
360
369
result = getMessage(res)
361
370
362
- proc sendDice* (b: TeleBot, chatId: int64 , disableNotification = false , replyToMessageId = 0 , replyMarkup: KeyboardMarkup = nil ): Future[Message] {.async.} =
371
+ proc sendDice* (b: TeleBot, chatId: int64 , emoji = " " , disableNotification = false , replyToMessageId = 0 , replyMarkup: KeyboardMarkup = nil ): Future[Message] {.async.} =
363
372
END_POINT(" sendDice" )
364
373
var data = newMultipartData()
365
374
366
375
data[" chat_id" ] = $ chatId
376
+ if emoji.len != 0 :
377
+ data[" emoji" ] = emoji
367
378
if disableNotification:
368
379
data[" disable_notification" ] = " true"
369
380
if replyToMessageId != 0 :
@@ -931,9 +942,6 @@ proc getUpdates*(b: TeleBot, offset, limit = 0, timeout = 50, allowedUpdates: se
931
942
b.lastUpdateId = result [result .len - 1 ][" update_id" ].toInt
932
943
933
944
proc handleUpdate* (b: TeleBot, update: Update) {.async.} =
934
- if update.updateId > b.lastUpdateId:
935
- b.lastUpdateId = update.updateId
936
-
937
945
# stop process other callbacks if a callback returns true
938
946
var stop = false
939
947
if update.inlineQuery.isSome:
0 commit comments