1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-17 22:03:48 +00:00

update Chat dependency in methods

This commit is contained in:
InsanusMokrassar 2020-02-06 13:38:52 +06:00
parent de1d6aa70c
commit 2cfabb1c2a
19 changed files with 45 additions and 26 deletions

View File

@ -5,6 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
import kotlinx.serialization.*
import kotlinx.serialization.internal.StringSerializer
@ -26,5 +27,5 @@ suspend fun RequestsExecutor.exportChatInviteLink(
) = execute(ExportChatInviteLink(chatId))
suspend fun RequestsExecutor.exportChatInviteLink(
chat: Chat
chat: PublicChat
) = exportChatInviteLink(chat.id)

View File

@ -5,6 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
@ -26,5 +27,5 @@ suspend fun RequestsExecutor.leaveChat(
) = execute(LeaveChat(chatId))
suspend fun RequestsExecutor.leaveChat(
chat: Chat
chat: PublicChat
) = leaveChat(chat.id)

View File

@ -7,6 +7,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.AdministratorChatMember
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.AdministratorChatMemberSerializerWithoutDeserialization
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
import kotlinx.serialization.*
import kotlinx.serialization.internal.ArrayListSerializer
@ -32,5 +33,5 @@ suspend fun RequestsExecutor.getChatAdministrators(
) = execute(GetChatAdministrators(chatId))
suspend fun RequestsExecutor.getChatAdministrators(
chat: Chat
chat: PublicChat
) = getChatAdministrators(chat.id)

View File

@ -5,6 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
import kotlinx.serialization.*
import kotlinx.serialization.internal.IntSerializer
@ -26,5 +27,5 @@ suspend fun RequestsExecutor.getChatMembersCount(
) = execute(GetChatMembersCount(chatId))
suspend fun RequestsExecutor.getChatMembersCount(
chat: Chat
chat: PublicChat
) = getChatMembersCount(chat.id)

View File

@ -7,6 +7,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.ChatMember
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.ChatMemberDeserializationStrategy
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import kotlinx.serialization.*
@Serializable
@ -29,7 +30,7 @@ suspend fun RequestsExecutor.getChatMember(
) = execute(GetChatMember(chatId, userId))
suspend fun RequestsExecutor.getChatMember(
chat: Chat,
chat: PublicChat,
userId: UserId
) = getChatMember(chat.id, userId)
@ -39,6 +40,6 @@ suspend fun RequestsExecutor.getChatMember(
) = getChatMember(chatId, user.id)
suspend fun RequestsExecutor.getChatMember(
chat: Chat,
chat: PublicChat,
user: User
) = getChatMember(chat.id, user.id)

View File

@ -5,6 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
@ -31,7 +32,7 @@ suspend fun RequestsExecutor.kickChatMember(
) = execute(KickChatMember(chatId, userId, untilDate))
suspend fun RequestsExecutor.kickChatMember(
chat: Chat,
chat: PublicChat,
userId: UserId,
untilDate: TelegramDate? = null
) = kickChatMember(chat.id, userId, untilDate)
@ -43,7 +44,7 @@ suspend fun RequestsExecutor.kickChatMember(
) = kickChatMember(chatId, user.id, untilDate)
suspend fun RequestsExecutor.kickChatMember(
chat: Chat,
chat: PublicChat,
user: User,
untilDate: TelegramDate? = null
) = kickChatMember(chat.id, user.id, untilDate)

View File

@ -5,6 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
@ -69,7 +70,7 @@ suspend fun RequestsExecutor.promoteChatMember(
)
suspend fun RequestsExecutor.promoteChatMember(
chat: Chat,
chat: PublicChat,
userId: UserId,
untilDate: TelegramDate? = null,
canChangeInfo: Boolean? = null,
@ -121,7 +122,7 @@ suspend fun RequestsExecutor.promoteChatMember(
)
suspend fun RequestsExecutor.promoteChatMember(
chat: Chat,
chat: PublicChat,
user: User,
untilDate: TelegramDate? = null,
canChangeInfo: Boolean? = null,

View File

@ -6,6 +6,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMe
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
@ -35,7 +36,7 @@ suspend fun RequestsExecutor.restrictChatMember(
) = execute(RestrictChatMember(chatId, userId, untilDate, permissions))
suspend fun RequestsExecutor.restrictChatMember(
chat: Chat,
chat: PublicChat,
userId: UserId,
untilDate: TelegramDate? = null,
permissions: ChatPermissions = ChatPermissions()
@ -49,7 +50,7 @@ suspend fun RequestsExecutor.restrictChatMember(
) = restrictChatMember(chatId, user.id, untilDate, permissions)
suspend fun RequestsExecutor.restrictChatMember(
chat: Chat,
chat: PublicChat,
user: User,
untilDate: TelegramDate? = null,
permissions: ChatPermissions = ChatPermissions()

View File

@ -4,6 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
@ -41,7 +42,7 @@ suspend fun RequestsExecutor.setChatAdministratorCustomTitle(
) = execute(SetChatAdministratorCustomTitle(chatId, userId, customTitle))
suspend fun RequestsExecutor.setChatAdministratorCustomTitle(
chat: Chat,
chat: PublicChat,
userId: UserId,
customTitle: String
) = setChatAdministratorCustomTitle(chat.id, userId, customTitle)
@ -53,7 +54,7 @@ suspend fun RequestsExecutor.setChatAdministratorCustomTitle(
) = setChatAdministratorCustomTitle(chatId, user.id, customTitle)
suspend fun RequestsExecutor.setChatAdministratorCustomTitle(
chat: Chat,
chat: PublicChat,
user: User,
customTitle: String
) = setChatAdministratorCustomTitle(chat.id, user.id, customTitle)

View File

@ -4,6 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
@ -27,7 +28,7 @@ suspend fun RequestsExecutor.unbanChatMember(
) = execute(UnbanChatMember(chatId, userId))
suspend fun RequestsExecutor.unbanChatMember(
chat: Chat,
chat: PublicChat,
userId: UserId
) = unbanChatMember(chat.id, userId)
@ -37,7 +38,7 @@ suspend fun RequestsExecutor.unbanChatMember(
) = unbanChatMember(chatId, user.id)
suspend fun RequestsExecutor.unbanChatMember(
chat: Chat,
chat: PublicChat,
user: User
) = unbanChatMember(chat.id, user.id)

View File

@ -6,6 +6,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleReque
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get.GetChat
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
@ -27,5 +28,5 @@ suspend fun RequestsExecutor.deleteChatPhoto(
) = execute(DeleteChatPhoto(chatId))
suspend fun RequestsExecutor.deleteChatPhoto(
chat: Chat
chat: PublicChat
) = deleteChatPhoto(chat.id)

View File

@ -5,6 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
@ -32,7 +33,7 @@ suspend fun RequestsExecutor.pinChatMessage(
) = execute(PinChatMessage(chatId, messageId, disableNotification))
suspend fun RequestsExecutor.pinChatMessage(
chat: Chat,
chat: PublicChat,
messageId: MessageIdentifier,
disableNotification: Boolean = false
) = pinChatMessage(chat.id, messageId, disableNotification)
@ -44,7 +45,7 @@ suspend fun RequestsExecutor.pinChatMessage(
) = execute(PinChatMessage(chatId, message.messageId, disableNotification))
suspend fun RequestsExecutor.pinChatMessage(
chat: Chat,
chat: PublicChat,
message: Message,
disableNotification: Boolean = false
) = pinChatMessage(chat.id, message.messageId, disableNotification)

View File

@ -5,6 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
@ -34,6 +35,6 @@ suspend fun RequestsExecutor.setChatDescription(
) = execute(SetChatDescription(chatId, description))
suspend fun RequestsExecutor.setChatDescription(
chat: Chat,
chat: PublicChat,
description: String
) = setChatDescription(chat.id, description)

View File

@ -6,6 +6,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleReque
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
@ -29,6 +30,6 @@ suspend fun RequestsExecutor.setChatPermissions(
) = execute(SetChatPermissions(chatId, permissions))
suspend fun RequestsExecutor.setChatPermissions(
chat: Chat,
chat: PublicChat,
permissions: ChatPermissions
) = setChatPermissions(chat.id, permissions)

View File

@ -7,6 +7,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartRe
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import com.github.insanusmokrassar.TelegramBotAPI.utils.toJson
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
@ -31,6 +32,6 @@ suspend fun RequestsExecutor.setChatPermissions(
) = execute(SetChatPhoto(chatId, photo))
suspend fun RequestsExecutor.setChatPermissions(
chat: Chat,
chat: PublicChat,
photo: MultipartFile
) = setChatPermissions(chat.id, photo)

View File

@ -6,6 +6,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFi
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
@ -35,6 +36,6 @@ suspend fun RequestsExecutor.setChatTitle(
) = execute(SetChatTitle(chatId, title))
suspend fun RequestsExecutor.setChatTitle(
chat: Chat,
chat: PublicChat,
title: String
) = setChatTitle(chat.id, title)

View File

@ -5,6 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
@ -26,5 +27,5 @@ suspend fun RequestsExecutor.unpinChatMessage(
) = execute(UnpinChatMessage(chatId))
suspend fun RequestsExecutor.unpinChatMessage(
chat: Chat
chat: PublicChat
) = unpinChatMessage(chat.id)

View File

@ -6,6 +6,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleReque
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify.DeleteChatPhoto
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
@ -27,5 +28,5 @@ suspend fun RequestsExecutor.deleteChatStickerSet(
) = execute(DeleteChatStickerSet(chatId))
suspend fun RequestsExecutor.deleteChatStickerSet(
chat: Chat
chat: PublicChat
) = deleteChatStickerSet(chat.id)

View File

@ -5,6 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
@ -28,6 +29,6 @@ suspend fun RequestsExecutor.setChatStickerSet(
) = execute(SetChatStickerSet(chatId, stickerSetName))
suspend fun RequestsExecutor.setChatStickerSet(
chat: Chat,
chat: PublicChat,
stickerSetName: StickerSetName
) = setChatStickerSet(chat.id, stickerSetName)