1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-26 03:58:44 +00:00

deprecate TelegramBot#getStickerSet

This commit is contained in:
InsanusMokrassar 2022-10-22 17:41:55 +06:00
parent 62a9c687d5
commit 8ed216619d
2 changed files with 16 additions and 0 deletions

View File

@ -10,6 +10,9 @@
* `Core`: * `Core`:
* Add opportunity to create command text source and add command in entities builder * Add opportunity to create command text source and add command in entities builder
via `BotCommamd` (thanks to [d1shin](https://github.com/InsanusMokrassar/TelegramBotAPI/pull/664)) via `BotCommamd` (thanks to [d1shin](https://github.com/InsanusMokrassar/TelegramBotAPI/pull/664))
* `API`:
* New extensions `TelegramBot#getStickerSetOrNull` and `TelegramBot#getStickerSetOrThrow`
* Old `TelegramBot#getStickerSet` has been deprecated
* `Behaviour Builder`: * `Behaviour Builder`:
* Add opportunity to use triggers and waiters with `BotCommand` (thanks to [d1shin](https://github.com/InsanusMokrassar/TelegramBotAPI/pull/664)) * Add opportunity to use triggers and waiters with `BotCommand` (thanks to [d1shin](https://github.com/InsanusMokrassar/TelegramBotAPI/pull/664))

View File

@ -10,8 +10,21 @@ suspend fun TelegramBot.getStickerSet(
GetStickerSet(name) GetStickerSet(name)
) )
@Deprecated("Renamed", ReplaceWith("getStickerSetOrThrow(sticker)", "dev.inmo.tgbotapi.extensions.api.get.getStickerSetOrThrow"))
suspend fun TelegramBot.getStickerSet( suspend fun TelegramBot.getStickerSet(
sticker: Sticker sticker: Sticker
) = getStickerSet( ) = getStickerSet(
sticker.stickerSetName ?: error("Sticker must contains stickerSetName to be correctly used in getStickerSet method") sticker.stickerSetName ?: error("Sticker must contains stickerSetName to be correctly used in getStickerSet method")
) )
suspend fun TelegramBot.getStickerSetOrNull(
sticker: Sticker
) = sticker.stickerSetName ?.let {
getStickerSet(it)
}
suspend fun TelegramBot.getStickerSetOrThrow(
sticker: Sticker
) = getStickerSet(
sticker.stickerSetName ?: error("Sticker must contains stickerSetName to be correctly used in getStickerSet method")
)