1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-23 00:57:13 +00:00

real fix:)

This commit is contained in:
InsanusMokrassar 2020-03-30 22:52:57 +06:00
parent 55ed3e165b
commit 013944c5c9
2 changed files with 32 additions and 36 deletions

View File

@ -1,4 +1,4 @@
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.stickers
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.thumbs
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
@ -10,65 +10,65 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.StickerSet
suspend fun RequestsExecutor.setStickerSetThumb(
userId: UserId,
stickerSetName: String,
sticker: FileId
thumbSetName: String,
thumb: FileId
) = execute(
SetStickerSetThumb(userId, stickerSetName, sticker)
SetStickerSetThumb(userId, thumbSetName, thumb)
)
suspend fun RequestsExecutor.setStickerSetThumb(
userId: UserId,
stickerSetName: String,
sticker: MultipartFile
thumbSetName: String,
thumb: MultipartFile
) = execute(
SetStickerSetThumb(userId, stickerSetName, sticker)
SetStickerSetThumb(userId, thumbSetName, thumb)
)
suspend fun RequestsExecutor.setStickerSetThumb(
user: CommonUser,
stickerSetName: String,
sticker: FileId
thumbSetName: String,
thumb: FileId
) = setStickerSetThumb(
user.id, stickerSetName, sticker
user.id, thumbSetName, thumb
)
suspend fun RequestsExecutor.setStickerSetThumb(
user: CommonUser,
stickerSetName: String,
sticker: MultipartFile
thumbSetName: String,
thumb: MultipartFile
) = setStickerSetThumb(
user.id, stickerSetName, sticker
user.id, thumbSetName, thumb
)
suspend fun RequestsExecutor.setStickerSetThumb(
userId: UserId,
stickerSet: StickerSet,
sticker: FileId
thumbSet: StickerSet,
thumb: FileId
) = setStickerSetThumb(
userId, stickerSet.name, sticker
userId, thumbSet.name, thumb
)
suspend fun RequestsExecutor.setStickerSetThumb(
userId: UserId,
stickerSet: StickerSet,
sticker: MultipartFile
thumbSet: StickerSet,
thumb: MultipartFile
) = setStickerSetThumb(
userId, stickerSet.name, sticker
userId, thumbSet.name, thumb
)
suspend fun RequestsExecutor.setStickerSetThumb(
user: CommonUser,
stickerSet: StickerSet,
sticker: FileId
thumbSet: StickerSet,
thumb: FileId
) = setStickerSetThumb(
user.id, stickerSet.name, sticker
user.id, thumbSet.name, thumb
)
suspend fun RequestsExecutor.setStickerSetThumb(
user: CommonUser,
stickerSet: StickerSet,
sticker: MultipartFile
thumbSet: StickerSet,
thumb: MultipartFile
) = setStickerSetThumb(
user.id, stickerSet.name, sticker
user.id, thumbSet.name, thumb
)

View File

@ -7,22 +7,18 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
import kotlinx.serialization.*
fun SetStickerSetThumb(
stickerSetName: String,
userId: UserId,
sticker: InputFile
stickerSetName: String,
thumb: MultipartFile
): Request<Boolean> {
val data = SetStickerSetThumb(userId, stickerSetName, sticker as? FileId)
return when (sticker) {
is MultipartFile -> CommonMultipartFileRequest(
data,
mapOf(thumbField to sticker)
)
is FileId -> data
}
return CommonMultipartFileRequest(
SetStickerSetThumb(userId, stickerSetName),
mapOf(thumbField to thumb)
)
}
@Serializable
data class SetStickerSetThumb internal constructor(
data class SetStickerSetThumb (
@SerialName(userIdField)
override val userId: UserId,
@SerialName(nameField)