1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 08:13:47 +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.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
@ -10,65 +10,65 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.StickerSet
suspend fun RequestsExecutor.setStickerSetThumb( suspend fun RequestsExecutor.setStickerSetThumb(
userId: UserId, userId: UserId,
stickerSetName: String, thumbSetName: String,
sticker: FileId thumb: FileId
) = execute( ) = execute(
SetStickerSetThumb(userId, stickerSetName, sticker) SetStickerSetThumb(userId, thumbSetName, thumb)
) )
suspend fun RequestsExecutor.setStickerSetThumb( suspend fun RequestsExecutor.setStickerSetThumb(
userId: UserId, userId: UserId,
stickerSetName: String, thumbSetName: String,
sticker: MultipartFile thumb: MultipartFile
) = execute( ) = execute(
SetStickerSetThumb(userId, stickerSetName, sticker) SetStickerSetThumb(userId, thumbSetName, thumb)
) )
suspend fun RequestsExecutor.setStickerSetThumb( suspend fun RequestsExecutor.setStickerSetThumb(
user: CommonUser, user: CommonUser,
stickerSetName: String, thumbSetName: String,
sticker: FileId thumb: FileId
) = setStickerSetThumb( ) = setStickerSetThumb(
user.id, stickerSetName, sticker user.id, thumbSetName, thumb
) )
suspend fun RequestsExecutor.setStickerSetThumb( suspend fun RequestsExecutor.setStickerSetThumb(
user: CommonUser, user: CommonUser,
stickerSetName: String, thumbSetName: String,
sticker: MultipartFile thumb: MultipartFile
) = setStickerSetThumb( ) = setStickerSetThumb(
user.id, stickerSetName, sticker user.id, thumbSetName, thumb
) )
suspend fun RequestsExecutor.setStickerSetThumb( suspend fun RequestsExecutor.setStickerSetThumb(
userId: UserId, userId: UserId,
stickerSet: StickerSet, thumbSet: StickerSet,
sticker: FileId thumb: FileId
) = setStickerSetThumb( ) = setStickerSetThumb(
userId, stickerSet.name, sticker userId, thumbSet.name, thumb
) )
suspend fun RequestsExecutor.setStickerSetThumb( suspend fun RequestsExecutor.setStickerSetThumb(
userId: UserId, userId: UserId,
stickerSet: StickerSet, thumbSet: StickerSet,
sticker: MultipartFile thumb: MultipartFile
) = setStickerSetThumb( ) = setStickerSetThumb(
userId, stickerSet.name, sticker userId, thumbSet.name, thumb
) )
suspend fun RequestsExecutor.setStickerSetThumb( suspend fun RequestsExecutor.setStickerSetThumb(
user: CommonUser, user: CommonUser,
stickerSet: StickerSet, thumbSet: StickerSet,
sticker: FileId thumb: FileId
) = setStickerSetThumb( ) = setStickerSetThumb(
user.id, stickerSet.name, sticker user.id, thumbSet.name, thumb
) )
suspend fun RequestsExecutor.setStickerSetThumb( suspend fun RequestsExecutor.setStickerSetThumb(
user: CommonUser, user: CommonUser,
stickerSet: StickerSet, thumbSet: StickerSet,
sticker: MultipartFile thumb: MultipartFile
) = setStickerSetThumb( ) = 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.* import kotlinx.serialization.*
fun SetStickerSetThumb( fun SetStickerSetThumb(
stickerSetName: String,
userId: UserId, userId: UserId,
sticker: InputFile stickerSetName: String,
thumb: MultipartFile
): Request<Boolean> { ): Request<Boolean> {
val data = SetStickerSetThumb(userId, stickerSetName, sticker as? FileId) return CommonMultipartFileRequest(
return when (sticker) { SetStickerSetThumb(userId, stickerSetName),
is MultipartFile -> CommonMultipartFileRequest( mapOf(thumbField to thumb)
data, )
mapOf(thumbField to sticker)
)
is FileId -> data
}
} }
@Serializable @Serializable
data class SetStickerSetThumb internal constructor( data class SetStickerSetThumb (
@SerialName(userIdField) @SerialName(userIdField)
override val userId: UserId, override val userId: UserId,
@SerialName(nameField) @SerialName(nameField)