mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-25 03:28:44 +00:00
update microutils and add banChatSenderChat and unbanChatSenderChat support
This commit is contained in:
parent
6c3425d5f9
commit
23f93075a4
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
* `Common`:
|
* `Common`:
|
||||||
* `Version`:
|
* `Version`:
|
||||||
* `MicroUtils`: `0.8.2` -> `0.8.5`
|
* `MicroUtils`: `0.8.2` -> `0.8.6`
|
||||||
* `Utils`:
|
* `Utils`:
|
||||||
* Fix of `EntitiesBuilder#linkln`
|
* Fix of `EntitiesBuilder#linkln`
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ klock_version=2.4.8
|
|||||||
uuid_version=0.3.1
|
uuid_version=0.3.1
|
||||||
ktor_version=1.6.5
|
ktor_version=1.6.5
|
||||||
|
|
||||||
micro_utils_version=0.8.5
|
micro_utils_version=0.8.6
|
||||||
|
|
||||||
javax_activation_version=1.1.1
|
javax_activation_version=1.1.1
|
||||||
|
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.chat.members
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.members.BanChatMember
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.members.BanChatSenderChat
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
||||||
|
|
||||||
|
suspend fun TelegramBot.banChatSenderChat(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
senderChatId: ChatId
|
||||||
|
) = execute(BanChatSenderChat(chatId, senderChatId))
|
||||||
|
|
||||||
|
suspend fun TelegramBot.banChatSenderChat(
|
||||||
|
chat: PublicChat,
|
||||||
|
senderChatId: ChatId
|
||||||
|
) = banChatSenderChat(chat.id, senderChatId)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.banChatSenderChat(
|
||||||
|
chatId: ChatId,
|
||||||
|
senderChat: PublicChat
|
||||||
|
) = banChatSenderChat(chatId, senderChat.id)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.banChatSenderChat(
|
||||||
|
chat: PublicChat,
|
||||||
|
senderChat: PublicChat,
|
||||||
|
) = banChatSenderChat(chat.id, senderChat)
|
@ -0,0 +1,26 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.chat.members
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.members.*
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
||||||
|
|
||||||
|
suspend fun TelegramBot.unbanChatSenderChat(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
senderChatId: ChatId
|
||||||
|
) = execute(UnbanChatSenderChat(chatId, senderChatId))
|
||||||
|
|
||||||
|
suspend fun TelegramBot.unbanChatSenderChat(
|
||||||
|
chat: PublicChat,
|
||||||
|
senderChatId: ChatId
|
||||||
|
) = unbanChatSenderChat(chat.id, senderChatId)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.unbanChatSenderChat(
|
||||||
|
chatId: ChatId,
|
||||||
|
senderChat: PublicChat
|
||||||
|
) = unbanChatSenderChat(chatId, senderChat.id)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.unbanChatSenderChat(
|
||||||
|
chat: PublicChat,
|
||||||
|
senderChat: PublicChat,
|
||||||
|
) = unbanChatSenderChat(chat.id, senderChat)
|
@ -0,0 +1,10 @@
|
|||||||
|
package dev.inmo.tgbotapi.requests.chat.abstracts
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.types.ChatRequest
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
|
import dev.inmo.tgbotapi.types.ChatId
|
||||||
|
import dev.inmo.tgbotapi.types.UserId
|
||||||
|
|
||||||
|
interface ChatSenderRequest : ChatRequest, SimpleRequest<Boolean> {
|
||||||
|
val senderChatId: ChatId
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package dev.inmo.tgbotapi.requests.chat.members
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.abstracts.ChatSenderRequest
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.builtins.serializer
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class BanChatSenderChat(
|
||||||
|
@SerialName(chatIdField)
|
||||||
|
override val chatId: ChatIdentifier,
|
||||||
|
@SerialName(senderChatIdField)
|
||||||
|
override val senderChatId: ChatId
|
||||||
|
) : ChatSenderRequest {
|
||||||
|
override fun method(): String = "banChatSenderChat"
|
||||||
|
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||||
|
get() = Boolean.serializer()
|
||||||
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
|
get() = serializer()
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package dev.inmo.tgbotapi.requests.chat.members
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.abstracts.ChatSenderRequest
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.builtins.serializer
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class UnbanChatSenderChat(
|
||||||
|
@SerialName(chatIdField)
|
||||||
|
override val chatId: ChatIdentifier,
|
||||||
|
@SerialName(senderChatIdField)
|
||||||
|
override val senderChatId: ChatId
|
||||||
|
) : ChatSenderRequest {
|
||||||
|
override fun method(): String = "unbanChatSenderChat"
|
||||||
|
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||||
|
get() = Boolean.serializer()
|
||||||
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
|
get() = serializer()
|
||||||
|
}
|
@ -96,6 +96,7 @@ val telegramInlineModeGifPermittedMimeTypes by lazy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const val chatIdField = "chat_id"
|
const val chatIdField = "chat_id"
|
||||||
|
const val senderChatIdField = "sender_chat_id"
|
||||||
const val messageIdField = "message_id"
|
const val messageIdField = "message_id"
|
||||||
const val updateIdField = "update_id"
|
const val updateIdField = "update_id"
|
||||||
const val fromChatIdField = "from_chat_id"
|
const val fromChatIdField = "from_chat_id"
|
||||||
|
Loading…
Reference in New Issue
Block a user