Skip to content

Commit b2ad9f9

Browse files
committed
Bot API 6.2
1 parent 2ceb34f commit b2ad9f9

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

src/telebot/private/api.nim

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -805,30 +805,36 @@ proc getStickerSet*(b: TeleBot, name: string): Future[StickerSet] {.async.} =
805805
let res = await makeRequest(b, procName, data)
806806
result = unmarshal(res, StickerSet)
807807

808+
proc getCustomEmojiStickers*(b: TeleBot, customEmojiIds: seq[string]): Future[seq[Sticker]] {.async.} =
809+
var data = newMultipartData()
810+
data["custom_emoji_ids"] = $customEmojiIds
811+
let res = await makeRequest(b, procName, data)
812+
result = unmarshal(res, seq[Sticker])
813+
808814
proc uploadStickerFile*(b: TeleBot, userId: int, pngSticker: string): Future[types.File] {.async.} =
809815
var data = newMultipartData()
810816
data["user_id"] = $userId
811817
data.addData("png_sticker", pngSticker, true)
812818
let res = await makeRequest(b, procName, data)
813819
result = unmarshal(res, types.File)
814820

815-
proc createNewStickerSet*(b: TeleBot, userId: int, name: string, title: string, pngSticker, tgsSticker, webmSticker: string,
816-
emojis: string, containsMasks = false, maskPosition: Option[MaskPosition]): Future[bool] {.async.} =
821+
proc createNewStickerSet*(b: TeleBot, userId: int, name, title, emojis: string, pngSticker, tgsSticker, webmSticker, stickerType = "",
822+
containsMasks = false, maskPosition: Option[MaskPosition]): Future[bool] {.async.} =
817823
var data = newMultipartData()
818824
data["user_id"] = $userId
819825
data["name"] = name
820826
data["title"] = title
827+
data["emojis"] = emojis
821828
if pngSticker.len != 0:
822829
data.addData("png_sticker", pngSticker, true)
823830
elif tgsSticker.len != 0:
824831
data.addData("tgs_sticker", tgsSticker, true)
825832
elif webmSticker.len != 0:
826-
data.addData("webm_sticker", tgsSticker, true)
833+
data.addData("webm_sticker", webmSticker, true)
827834
else:
828835
raise newException(ValueError, "png_sticker, tgs_sticker or webm_sticker must be set")
829-
data["emojis"] = emojis
830-
if containsMasks:
831-
data["contains_masks"] = "true"
836+
if stickerType.len != 0:
837+
data["sticker_type"] = stickerType
832838
if maskPosition.isSome():
833839
var tmp = ""
834840
maskPosition.marshal(tmp)

src/telebot/private/types.nim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,15 @@ type
121121
setName*: Option[string]
122122
premiumAnimation*: Option[File]
123123
maskPosition*: Option[MaskPosition]
124+
customEmojiId*: Option[string]
124125
fileSize*: Option[int]
125126

126127
StickerSet* = object of TelegramObject
127128
name*: string
128129
title*: string
130+
stickerType*: string
129131
isAnimated*: bool
130132
isVideo*: bool
131-
containsMasks*: bool
132133
stickers*: seq[Sticker]
133134
thumb*: Option[PhotoSize]
134135

@@ -319,6 +320,7 @@ type
319320
url*: Option[string]
320321
user*: Option[User]
321322
language*: Option[string]
323+
customEmojiId*: Option[string]
322324

323325
Message* = object of TelegramObject
324326
messageId*: int

telebot.nimble

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

0 commit comments

Comments
 (0)