@@ -156,6 +156,12 @@ magic Poll:
156
156
replyToMessageId: int {.optional.}
157
157
replyMarkup: KeyboardMarkup {.optional.}
158
158
159
+ magic Dice:
160
+ chatId: int64
161
+ disableNotification: string {.optional.}
162
+ replyToMessageId: int {.optional.}
163
+ replyMarkup: KeyboardMarkup {.optional.}
164
+
159
165
proc getMe* (b: TeleBot): Future[User] {.async.} =
160
166
# # Returns basic information about the bot in form of a ``User`` object.
161
167
END_POINT(" getMe" )
@@ -376,13 +382,18 @@ proc uploadStickerFile*(b: TeleBot, userId: int, pngSticker: string): Future[typ
376
382
let res = await makeRequest(b, endpoint % b.token, data)
377
383
result = unmarshal(res, types.File)
378
384
379
- proc createNewStickerSet* (b: TeleBot, userId: int , name: string , title: string , pngSticker: string , emojis: string , containsMasks = false , maskPosition: Option[MaskPosition]) : Future[bool ] {.async.} =
385
+ proc createNewStickerSet* (b: TeleBot, userId: int , name: string , title: string , pngSticker: string , tgsSticker: string , emojis: string , containsMasks = false , maskPosition: Option[MaskPosition]) : Future[bool ] {.async.} =
380
386
END_POINT(" createNewStickerSet" )
381
387
var data = newMultipartData()
382
388
data[" user_id" ] = $ userId
383
389
data[" name" ] = name
384
390
data[" title" ] = title
385
- data.addFiles({" png_sticker" : pngSticker})
391
+ if pngSticker.len != 0 :
392
+ data.addFiles({" png_sticker" : pngSticker})
393
+ elif tgsSticker.len != 0 :
394
+ data.addFiles({" tgs_sticker" : tgsSticker})
395
+ else :
396
+ raise newException(ValueError, " Either png_sticker or tgs_sticker must be set" )
386
397
data[" emojis" ] = emojis
387
398
if containsMasks:
388
399
data[" contains_masks" ] = " true"
@@ -393,12 +404,17 @@ proc createNewStickerSet*(b: TeleBot, userId: int, name: string, title: string,
393
404
let res = await makeRequest(b, endpoint % b.token, data)
394
405
result = res.toBool
395
406
396
- proc addStickerToSet* (b: TeleBot, userId: int , name: string , pngSticker: string , emojis: string , maskPosition: Option[MaskPosition]) : Future[bool ] {.async.} =
407
+ proc addStickerToSet* (b: TeleBot, userId: int , name: string , pngSticker: string , tgsSticker: string , emojis: string , maskPosition: Option[MaskPosition]) : Future[bool ] {.async.} =
397
408
END_POINT(" addStickerToSet" )
398
409
var data = newMultipartData()
399
410
data[" user_id" ] = $ userId
400
411
data[" name" ] = name
401
- data.addFiles({" png_sticker" : pngSticker})
412
+ if pngSticker.len != 0 :
413
+ data.addFiles({" png_sticker" : pngSticker})
414
+ elif tgsSticker.len != 0 :
415
+ data.addFiles({" tgs_sticker" : tgsSticker})
416
+ else :
417
+ raise newException(ValueError, " Either png_sticker or tgs_sticker must be set" )
402
418
data[" emojis" ] = emojis
403
419
if maskPosition.isSome():
404
420
var tmp = " "
@@ -422,6 +438,17 @@ proc deleteStickerFromSet*(b: TeleBot, sticker: string): Future[bool] {.async.}
422
438
let res = await makeRequest(b, endpoint % b.token, data)
423
439
result = res.toBool
424
440
441
+ proc setStickerSetThumb* (b: TeleBot, name: string , userId: int , thumb = " " ): Future[bool ] {.async.} =
442
+ END_POINT(" setStickerSetThumb" )
443
+ var data = newMultipartData()
444
+ data[" name" ] = name
445
+ data[" user_id" ] = $ userId
446
+ if thumb.len != 0 :
447
+ data.addFiles({" thumb" : thumb})
448
+
449
+ let res = await makeRequest(b, endpoint % b.token, data)
450
+ result = res.toBool
451
+
425
452
proc setChatStickerSet* (b: TeleBot, chatId: string , stickerSetname: string ): Future[bool ] {.async.} =
426
453
END_POINT(" setChatStickerSet" )
427
454
var data = newMultipartData()
@@ -616,6 +643,22 @@ proc answerCallbackQuery*(b: TeleBot, callbackQueryId: string, text = "", showAl
616
643
let res = await makeRequest(b, endpoint % b.token, data)
617
644
result = res.toBool
618
645
646
+ proc setMyCommands* (b: TeleBot, commands: seq [BotCommand]) : Future[bool ] {.async.} =
647
+ END_POINT(" setMyCommands" )
648
+ var data = newMultipartData()
649
+ var json = " "
650
+ marshal(commands, json)
651
+ data[" commands" ] = json
652
+
653
+ let res = await makeRequest(b, endpoint % b.token, data)
654
+ result = res.toBool
655
+
656
+ proc getMyCommands* (b: TeleBot): Future[seq [BotCommand]] {.async.} =
657
+ END_POINT(" etMyCommands" )
658
+
659
+ let res = await makeRequest(b, endpoint % b.token)
660
+ result = unmarshal(res, seq [BotCommand])
661
+
619
662
proc answerInlineQuery* [T](b: TeleBot, id: string , results: seq [T], cacheTime = 0, isPersonal = false, nextOffset = "", switchPmText = "", switchPmParameter = ""): Future[bool ] {.async.} =
620
663
const endpoint = API_URL & "answerInlineQuery"
621
664
if results.len == 0:
0 commit comments