diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/DeleteStickerSet.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/DeleteStickerSet.kt new file mode 100644 index 0000000000..bae7665e09 --- /dev/null +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/DeleteStickerSet.kt @@ -0,0 +1,25 @@ +package dev.inmo.tgbotapi.extensions.api.stickers + +import dev.inmo.tgbotapi.bot.TelegramBot +import dev.inmo.tgbotapi.requests.abstracts.FileId +import dev.inmo.tgbotapi.requests.stickers.DeleteStickerFromSet +import dev.inmo.tgbotapi.requests.stickers.DeleteStickerSet +import dev.inmo.tgbotapi.types.StickerSetName +import dev.inmo.tgbotapi.types.files.Sticker +import dev.inmo.tgbotapi.types.stickers.StickerSet + +suspend fun TelegramBot.deleteStickerSet( + name: StickerSetName +) = execute( + DeleteStickerSet(name) +) + +suspend fun TelegramBot.deleteStickerSet( + sticker: Sticker +) = deleteStickerSet( + sticker.stickerSetName ?: error("Unable to take name of sticker set from sticker $sticker") +) + +suspend fun TelegramBot.deleteStickerSet( + stickerSet: StickerSet, +) = deleteStickerSet(stickerSet.name) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/DeleteStickerSet.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/DeleteStickerSet.kt new file mode 100644 index 0000000000..7c807b5adb --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/DeleteStickerSet.kt @@ -0,0 +1,21 @@ +package dev.inmo.tgbotapi.requests.stickers + +import dev.inmo.tgbotapi.requests.abstracts.FileId +import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest +import dev.inmo.tgbotapi.types.StickerSetName +import dev.inmo.tgbotapi.types.nameField +import dev.inmo.tgbotapi.types.stickerField +import kotlinx.serialization.* +import kotlinx.serialization.builtins.serializer + +@Serializable +data class DeleteStickerSet( + @SerialName(nameField) + val name: StickerSetName +) : SimpleRequest { + override fun method(): String = "deleteStickerSet" + override val resultDeserializer: DeserializationStrategy + get() = Boolean.serializer() + override val requestSerializer: SerializationStrategy<*> + get() = serializer() +}