diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerSetThumb.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerSetThumb.kt index 8831061c60..d38f7ed4f3 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerSetThumb.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerSetThumb.kt @@ -3,27 +3,95 @@ package dev.inmo.tgbotapi.extensions.api.thumbs import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.abstracts.FileId import dev.inmo.tgbotapi.requests.abstracts.MultipartFile -import dev.inmo.tgbotapi.requests.stickers.SetStickerSetThumb +import dev.inmo.tgbotapi.requests.stickers.SetStickerSetThumbnail +import dev.inmo.tgbotapi.types.StickerSetName import dev.inmo.tgbotapi.types.chat.CommonUser import dev.inmo.tgbotapi.types.UserId import dev.inmo.tgbotapi.types.stickers.StickerSet +suspend fun TelegramBot.setStickerSetThumbnail( + userId: UserId, + stickerSetName: StickerSetName, + thumbnail: FileId +) = execute( + SetStickerSetThumbnail(userId, stickerSetName, thumbnail) +) + +suspend fun TelegramBot.setStickerSetThumbnail( + userId: UserId, + stickerSetName: StickerSetName, + thumbnail: MultipartFile +) = execute( + SetStickerSetThumbnail(userId, stickerSetName, thumbnail) +) + +suspend fun TelegramBot.setStickerSetThumbnail( + user: CommonUser, + stickerSetName: StickerSetName, + thumbnail: FileId +) = setStickerSetThumbnail( + user.id, stickerSetName, thumbnail +) + +suspend fun TelegramBot.setStickerSetThumbnail( + user: CommonUser, + stickerSetName: StickerSetName, + thumbnail: MultipartFile +) = setStickerSetThumbnail( + user.id, stickerSetName, thumbnail +) + +suspend fun TelegramBot.setStickerSetThumbnail( + userId: UserId, + stickerSet: StickerSet, + thumbnail: FileId +) = setStickerSetThumbnail( + userId, stickerSet.name, thumbnail +) + +suspend fun TelegramBot.setStickerSetThumbnail( + userId: UserId, + stickerSet: StickerSet, + thumbnail: MultipartFile +) = setStickerSetThumbnail( + userId, stickerSet.name, thumbnail +) + +suspend fun TelegramBot.setStickerSetThumbnail( + user: CommonUser, + stickerSet: StickerSet, + thumbnail: FileId +) = setStickerSetThumbnail( + user.id, stickerSet.name, thumbnail +) + +suspend fun TelegramBot.setStickerSetThumbnail( + user: CommonUser, + stickerSet: StickerSet, + thumbnail: MultipartFile +) = setStickerSetThumbnail( + user.id, stickerSet.name, thumbnail +) + +@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(userId, thumbSetName, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail")) suspend fun TelegramBot.setStickerSetThumb( userId: UserId, thumbSetName: String, thumb: FileId ) = execute( - SetStickerSetThumb(userId, thumbSetName, thumb) + SetStickerSetThumbnail(userId, thumbSetName, thumb) ) +@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(userId, thumbSetName, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail")) suspend fun TelegramBot.setStickerSetThumb( userId: UserId, thumbSetName: String, thumb: MultipartFile ) = execute( - SetStickerSetThumb(userId, thumbSetName, thumb) + SetStickerSetThumbnail(userId, thumbSetName, thumb) ) +@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(user, thumbSetName, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail")) suspend fun TelegramBot.setStickerSetThumb( user: CommonUser, thumbSetName: String, @@ -32,6 +100,7 @@ suspend fun TelegramBot.setStickerSetThumb( user.id, thumbSetName, thumb ) +@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(user, thumbSetName, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail")) suspend fun TelegramBot.setStickerSetThumb( user: CommonUser, thumbSetName: String, @@ -40,6 +109,7 @@ suspend fun TelegramBot.setStickerSetThumb( user.id, thumbSetName, thumb ) +@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(userId, thumbSet, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail")) suspend fun TelegramBot.setStickerSetThumb( userId: UserId, thumbSet: StickerSet, @@ -48,6 +118,7 @@ suspend fun TelegramBot.setStickerSetThumb( userId, thumbSet.name, thumb ) +@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(userId, thumbSet, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail")) suspend fun TelegramBot.setStickerSetThumb( userId: UserId, thumbSet: StickerSet, @@ -56,6 +127,7 @@ suspend fun TelegramBot.setStickerSetThumb( userId, thumbSet.name, thumb ) +@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(user, thumbSet, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail")) suspend fun TelegramBot.setStickerSetThumb( user: CommonUser, thumbSet: StickerSet, @@ -64,6 +136,7 @@ suspend fun TelegramBot.setStickerSetThumb( user.id, thumbSet.name, thumb ) +@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(user, thumbSet, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail")) suspend fun TelegramBot.setStickerSetThumb( user: CommonUser, thumbSet: StickerSet, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/SetStickerSetThumb.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/SetStickerSetThumb.kt deleted file mode 100644 index 821f005b64..0000000000 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/SetStickerSetThumb.kt +++ /dev/null @@ -1,33 +0,0 @@ -package dev.inmo.tgbotapi.requests.stickers - -import dev.inmo.tgbotapi.requests.abstracts.* -import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest -import dev.inmo.tgbotapi.requests.stickers.abstracts.OwnerStickerSetAction -import dev.inmo.tgbotapi.types.* -import kotlinx.serialization.* - -fun SetStickerSetThumb( - userId: UserId, - stickerSetName: String, - thumbnail: MultipartFile -): Request { - return CommonMultipartFileRequest( - SetStickerSetThumb(userId, stickerSetName), - mapOf(thumbnailField to thumbnail) - ) -} - -@Serializable -data class SetStickerSetThumb ( - @SerialName(userIdField) - override val userId: UserId, - @SerialName(nameField) - override val name: StickerSetName, - @SerialName(thumbnailField) - val thumb: FileId? = null -) : OwnerStickerSetAction { - override val requestSerializer: SerializationStrategy<*> - get() = serializer() - - override fun method(): String = "setStickerSetThumb" -} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/SetStickerSetThumbnail.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/SetStickerSetThumbnail.kt new file mode 100644 index 0000000000..588ff1b64b --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/SetStickerSetThumbnail.kt @@ -0,0 +1,47 @@ +package dev.inmo.tgbotapi.requests.stickers + +import dev.inmo.tgbotapi.requests.abstracts.* +import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest +import dev.inmo.tgbotapi.requests.stickers.abstracts.OwnerStickerSetAction +import dev.inmo.tgbotapi.types.* +import kotlinx.serialization.* + +fun SetStickerSetThumbnail( + userId: UserId, + stickerSetName: String, + thumbnail: MultipartFile +): Request { + return CommonMultipartFileRequest( + SetStickerSetThumbnail(userId, stickerSetName), + mapOf(thumbnailField to thumbnail) + ) +} + +@Deprecated("Renamed", ReplaceWith("SetStickerSetThumbnail(userId, stickerSetName, thumbnail)", "dev.inmo.tgbotapi.requests.stickers.SetStickerSetThumbnail")) +fun SetStickerSetThumb( + userId: UserId, + stickerSetName: String, + thumbnail: MultipartFile +): Request = SetStickerSetThumbnail(userId, stickerSetName, thumbnail) + +@Serializable +data class SetStickerSetThumbnail ( + @SerialName(userIdField) + override val userId: UserId, + @SerialName(nameField) + override val name: StickerSetName, + @SerialName(thumbnailField) + val thumbnail: FileId? = null +) : OwnerStickerSetAction { + override val requestSerializer: SerializationStrategy<*> + get() = serializer() + + override fun method(): String = "setStickerSetThumbnail" +} + +@Deprecated("Renamed", ReplaceWith("SetStickerSetThumbnail(userId, name, thumbnail)", "dev.inmo.tgbotapi.requests.stickers.SetStickerSetThumbnail")) +fun SetStickerSetThumb( + userId: UserId, + name: StickerSetName, + thumbnail: FileId? = null +) = SetStickerSetThumbnail(userId, name, thumbnail)