Skip to content

Commit 3359c47

Browse files
committed
Bot API 5.7 - Video Stickers
1 parent 5b67e83 commit 3359c47

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

src/telebot/private/api.nim

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ proc uploadStickerFile*(b: TeleBot, userId: int, pngSticker: string): Future[typ
731731
let res = await makeRequest(b, procName, data)
732732
result = unmarshal(res, types.File)
733733

734-
proc createNewStickerSet*(b: TeleBot, userId: int, name: string, title: string, pngSticker: string, tgsSticker: string,
734+
proc createNewStickerSet*(b: TeleBot, userId: int, name: string, title: string, pngSticker, tgsSticker, webmSticker: string,
735735
emojis: string, containsMasks = false, maskPosition: Option[MaskPosition]): Future[bool] {.async.} =
736736
var data = newMultipartData()
737737
data["user_id"] = $userId
@@ -741,8 +741,10 @@ proc createNewStickerSet*(b: TeleBot, userId: int, name: string, title: string,
741741
data.addData("png_sticker", pngSticker, true)
742742
elif tgsSticker.len != 0:
743743
data.addData("tgs_sticker", tgsSticker, true)
744+
elif webmSticker.len != 0:
745+
data.addData("webm_sticker", tgsSticker, true)
744746
else:
745-
raise newException(ValueError, "Either png_sticker or tgs_sticker must be set")
747+
raise newException(ValueError, "png_sticker, tgs_sticker or webm_sticker must be set")
746748
data["emojis"] = emojis
747749
if containsMasks:
748750
data["contains_masks"] = "true"
@@ -753,16 +755,18 @@ proc createNewStickerSet*(b: TeleBot, userId: int, name: string, title: string,
753755
let res = await makeRequest(b, procName, data)
754756
result = res.getBool
755757

756-
proc addStickerToSet*(b: TeleBot, userId: int, name: string, pngSticker: string, tgsSticker: string, emojis: string, maskPosition: Option[MaskPosition]): Future[bool] {.async.} =
758+
proc addStickerToSet*(b: TeleBot, userId: int, name: string, pngSticker, tgsSticker, webmSticker, emojis: string, maskPosition: Option[MaskPosition]): Future[bool] {.async.} =
757759
var data = newMultipartData()
758760
data["user_id"] = $userId
759761
data["name"] = name
760762
if pngSticker.len != 0:
761763
data.addData("png_sticker", pngSticker, true)
762764
elif tgsSticker.len != 0:
763765
data.addData("tgs_sticker", tgsSticker, true)
766+
elif webmSticker.len != 0:
767+
data.addData("webm_sticker", tgsSticker, true)
764768
else:
765-
raise newException(ValueError, "Either png_sticker or tgs_sticker must be set")
769+
raise newException(ValueError, "png_sticker, tgs_sticker or webm_sticker must be set")
766770
data["emojis"] = emojis
767771
if maskPosition.isSome():
768772
var tmp = ""

src/telebot/private/types.nim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ type
111111
width*: int
112112
height*: int
113113
isAnimated*: bool
114+
isVideo*: bool
114115
thumb*: Option[PhotoSize]
115116
emoji*: Option[string]
116117
setName*: Option[string]
@@ -121,6 +122,7 @@ type
121122
name*: string
122123
title*: string
123124
isAnimated*: bool
125+
isVideo*: bool
124126
containsMasks*: bool
125127
stickers*: seq[Sticker]
126128
thumb*: Option[PhotoSize]

telebot.nimble

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

0 commit comments

Comments
 (0)