1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-23 00:57:13 +00:00

add get sticker set extensions

This commit is contained in:
InsanusMokrassar 2020-02-06 23:38:37 +06:00
parent 3a0be49cc5
commit 2399dc0d0a

View File

@ -1,6 +1,8 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.get
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker
import com.github.insanusmokrassar.TelegramBotAPI.types.stickerSetNameField
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.StickerSet
import kotlinx.serialization.*
@ -16,3 +18,15 @@ data class GetStickerSet(
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}
suspend fun RequestsExecutor.getStickerSet(
name: String
) = execute(
GetStickerSet(name)
)
suspend fun RequestsExecutor.getStickerSet(
sticker: Sticker
) = execute(
GetStickerSet(sticker.stickerSetName ?: error("Sticker must contains stickerSetName to be correctly used in getStickerSet method"))
)