1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-18 06:13:47 +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 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.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker
import com.github.insanusmokrassar.TelegramBotAPI.types.stickerSetNameField import com.github.insanusmokrassar.TelegramBotAPI.types.stickerSetNameField
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.StickerSet import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.StickerSet
import kotlinx.serialization.* import kotlinx.serialization.*
@ -16,3 +18,15 @@ data class GetStickerSet(
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() 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"))
)