rename setStickerSetThumb to setStickerSetThumbnail

This commit is contained in:
InsanusMokrassar 2023-03-10 12:11:17 +06:00
parent e30361ad1e
commit e7b21dcd3d
3 changed files with 123 additions and 36 deletions

View File

@ -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,

View File

@ -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<Boolean> {
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"
}

View File

@ -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<Boolean> {
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<Boolean> = 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)