mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-22 16:47:13 +00:00
ChatAdministratorRightsImpl -> ChatCommonAdministratorRights
This commit is contained in:
parent
73a748d8b3
commit
affa2a3a57
@ -2,7 +2,8 @@
|
||||
|
||||
## 9.2.0
|
||||
|
||||
* All the request chat keyboards has changed their parameters `ChatAdministratorRights` to `ChatAdministratorRightsImpl`
|
||||
* Rename `ChatAdministratorRightsImpl` -> `ChatCommonAdministratorRights`
|
||||
* All the request chat keyboards has changed their parameters `ChatAdministratorRights` to `ChatCommonAdministratorRights`
|
||||
|
||||
## 9.1.2
|
||||
|
||||
|
@ -2,17 +2,17 @@ package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.SetMyDefaultAdministratorRights
|
||||
import dev.inmo.tgbotapi.types.chat.member.ChatAdministratorRightsImpl
|
||||
import dev.inmo.tgbotapi.types.chat.member.ChatCommonAdministratorRights
|
||||
|
||||
suspend fun TelegramBot.setMyDefaultAdministratorRights(
|
||||
rights: ChatAdministratorRightsImpl,
|
||||
rights: ChatCommonAdministratorRights,
|
||||
forChannels: Boolean? = null
|
||||
) = execute(SetMyDefaultAdministratorRights(rights, forChannels))
|
||||
|
||||
suspend fun TelegramBot.setMyDefaultAdministratorRightsForChannels(
|
||||
rights: ChatAdministratorRightsImpl
|
||||
rights: ChatCommonAdministratorRights
|
||||
) = setMyDefaultAdministratorRights(rights, forChannels = true)
|
||||
|
||||
suspend fun TelegramBot.setMyDefaultAdministratorRightsForGroupsAndSupergroups(
|
||||
rights: ChatAdministratorRightsImpl
|
||||
rights: ChatCommonAdministratorRights
|
||||
) = setMyDefaultAdministratorRights(rights, forChannels = false)
|
||||
|
@ -2,14 +2,14 @@ package dev.inmo.tgbotapi.requests.bot
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.chat.member.ChatAdministratorRightsImpl
|
||||
import dev.inmo.tgbotapi.types.chat.member.ChatCommonAdministratorRights
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@Serializable
|
||||
class SetMyDefaultAdministratorRights(
|
||||
@SerialName(rightsField)
|
||||
val rights: ChatAdministratorRightsImpl,
|
||||
val rights: ChatCommonAdministratorRights,
|
||||
@SerialName(forChannelsField)
|
||||
val forChannels: Boolean? = null
|
||||
) : SimpleRequest<Boolean> {
|
||||
|
@ -2,8 +2,7 @@ package dev.inmo.tgbotapi.types.buttons
|
||||
|
||||
import dev.inmo.tgbotapi.types.botAdministratorRightsField
|
||||
import dev.inmo.tgbotapi.types.botIsMemberField
|
||||
import dev.inmo.tgbotapi.types.chat.member.ChatAdministratorRights
|
||||
import dev.inmo.tgbotapi.types.chat.member.ChatAdministratorRightsImpl
|
||||
import dev.inmo.tgbotapi.types.chat.member.ChatCommonAdministratorRights
|
||||
import dev.inmo.tgbotapi.types.chatHasUsernameField
|
||||
import dev.inmo.tgbotapi.types.chatIsChannelField
|
||||
import dev.inmo.tgbotapi.types.chatIsCreatedField
|
||||
@ -31,9 +30,9 @@ data class KeyboardButtonRequestChat(
|
||||
@SerialName(chatIsCreatedField)
|
||||
val isOwnedBy: Boolean? = null,
|
||||
@SerialName(userAdministratorRightsField)
|
||||
val userRightsInChat: ChatAdministratorRightsImpl? = null,
|
||||
val userRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
@SerialName(botAdministratorRightsField)
|
||||
val botRightsInChat: ChatAdministratorRightsImpl? = null,
|
||||
val botRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
@SerialName(botIsMemberField)
|
||||
val botIsMember: Boolean? = null
|
||||
) {
|
||||
@ -42,8 +41,8 @@ data class KeyboardButtonRequestChat(
|
||||
requestId: RequestId,
|
||||
isPublic: Boolean? = null,
|
||||
isOwnedBy: Boolean? = null,
|
||||
userRightsInChat: ChatAdministratorRightsImpl? = null,
|
||||
botRightsInChat: ChatAdministratorRightsImpl? = null,
|
||||
userRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botIsMember: Boolean? = null
|
||||
) = KeyboardButtonRequestChat(
|
||||
requestId = requestId,
|
||||
@ -61,8 +60,8 @@ data class KeyboardButtonRequestChat(
|
||||
isForum: Boolean? = null,
|
||||
isPublic: Boolean? = null,
|
||||
isOwnedBy: Boolean? = null,
|
||||
userRightsInChat: ChatAdministratorRightsImpl? = null,
|
||||
botRightsInChat: ChatAdministratorRightsImpl? = null,
|
||||
userRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botIsMember: Boolean? = null
|
||||
) = KeyboardButtonRequestChat(
|
||||
requestId = requestId,
|
||||
|
@ -1,8 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.buttons.reply
|
||||
|
||||
import dev.inmo.tgbotapi.types.buttons.*
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.*
|
||||
import dev.inmo.tgbotapi.types.chat.member.ChatAdministratorRightsImpl
|
||||
import dev.inmo.tgbotapi.types.chat.member.ChatCommonAdministratorRights
|
||||
import dev.inmo.tgbotapi.types.request.RequestId
|
||||
import dev.inmo.tgbotapi.types.webapps.WebAppInfo
|
||||
|
||||
@ -120,8 +119,8 @@ inline fun requestChatReplyButton(
|
||||
isForum: Boolean? = null,
|
||||
isPublic: Boolean? = null,
|
||||
isOwnedBy: Boolean? = null,
|
||||
userRightsInChat: ChatAdministratorRightsImpl? = null,
|
||||
botRightsInChat: ChatAdministratorRightsImpl? = null,
|
||||
userRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botIsMember: Boolean = false
|
||||
) = requestChatReplyButton(
|
||||
text,
|
||||
@ -145,8 +144,8 @@ inline fun requestChannelReplyButton(
|
||||
requestId: RequestId,
|
||||
isPublic: Boolean? = null,
|
||||
isOwnedBy: Boolean? = null,
|
||||
userRightsInChat: ChatAdministratorRightsImpl? = null,
|
||||
botRightsInChat: ChatAdministratorRightsImpl? = null,
|
||||
userRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botIsMember: Boolean = false
|
||||
) = requestChatReplyButton(
|
||||
text,
|
||||
@ -170,8 +169,8 @@ inline fun requestChannelReplyButton(
|
||||
isForum: Boolean? = null,
|
||||
isPublic: Boolean? = null,
|
||||
isOwnedBy: Boolean? = null,
|
||||
userRightsInChat: ChatAdministratorRightsImpl? = null,
|
||||
botRightsInChat: ChatAdministratorRightsImpl? = null,
|
||||
userRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botIsMember: Boolean? = null
|
||||
) = requestChatReplyButton(
|
||||
text,
|
||||
|
@ -1,8 +1,5 @@
|
||||
package dev.inmo.tgbotapi.types.chat.member
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import kotlinx.serialization.SerialName
|
||||
|
||||
sealed interface SpecialChatAdministratorRights {
|
||||
val canChangeInfo: Boolean
|
||||
val canInviteUsers: Boolean
|
||||
@ -40,7 +37,7 @@ sealed interface ChatAdministratorRights : SpecialChatAdministratorRights {
|
||||
canPostStories: Boolean = false,
|
||||
canEditStories: Boolean = false,
|
||||
canDeleteStories: Boolean = false
|
||||
) = ChatAdministratorRightsImpl(
|
||||
) = ChatCommonAdministratorRights(
|
||||
canChangeInfo = canChangeInfo,
|
||||
canPostMessages = canPostMessages,
|
||||
canEditMessages = canEditMessages,
|
||||
|
@ -5,7 +5,7 @@ import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class ChatAdministratorRightsImpl(
|
||||
data class ChatCommonAdministratorRights(
|
||||
@SerialName(canChangeInfoField)
|
||||
override val canChangeInfo: Boolean = false,
|
||||
@SerialName(canPostMessagesField)
|
||||
@ -37,3 +37,12 @@ data class ChatAdministratorRightsImpl(
|
||||
@SerialName(canDeleteStoriesField)
|
||||
override val canDeleteStories: Boolean = false
|
||||
) : ChatAdministratorRights
|
||||
|
||||
@Deprecated(
|
||||
"Renamed to ChatCommonAdministratorRights and will be removed soon",
|
||||
ReplaceWith(
|
||||
"ChatCommonAdministratorRights",
|
||||
"dev.inmo.tgbotapi.types.chat.member.ChatCommonAdministratorRights"
|
||||
)
|
||||
)
|
||||
typealias ChatAdministratorRightsImpl = ChatCommonAdministratorRights
|
@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.utils.types.buttons
|
||||
import dev.inmo.tgbotapi.types.buttons.*
|
||||
import dev.inmo.tgbotapi.types.buttons.reply.requestChatReplyButton
|
||||
import dev.inmo.tgbotapi.types.buttons.reply.requestUserReplyButton
|
||||
import dev.inmo.tgbotapi.types.chat.member.ChatAdministratorRightsImpl
|
||||
import dev.inmo.tgbotapi.types.chat.member.ChatCommonAdministratorRights
|
||||
import dev.inmo.tgbotapi.types.request.RequestId
|
||||
import dev.inmo.tgbotapi.types.webapps.WebAppInfo
|
||||
import dev.inmo.tgbotapi.utils.*
|
||||
@ -220,8 +220,8 @@ inline fun ReplyKeyboardRowBuilder.requestChatButton(
|
||||
isForum: Boolean? = null,
|
||||
isPublic: Boolean? = null,
|
||||
isOwnedBy: Boolean? = null,
|
||||
userRightsInChat: ChatAdministratorRightsImpl? = null,
|
||||
botRightsInChat: ChatAdministratorRightsImpl? = null,
|
||||
userRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botIsMember: Boolean? = null
|
||||
) = requestChatButton(
|
||||
text,
|
||||
@ -248,8 +248,8 @@ inline fun ReplyKeyboardRowBuilder.requestChannelButton(
|
||||
requestId: RequestId,
|
||||
isPublic: Boolean? = null,
|
||||
isOwnedBy: Boolean? = null,
|
||||
userRightsInChat: ChatAdministratorRightsImpl? = null,
|
||||
botRightsInChat: ChatAdministratorRightsImpl? = null,
|
||||
userRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botIsMember: Boolean? = null
|
||||
) = requestChatButton(
|
||||
text,
|
||||
@ -275,8 +275,8 @@ inline fun ReplyKeyboardRowBuilder.requestGroupButton(
|
||||
isForum: Boolean? = null,
|
||||
isPublic: Boolean? = null,
|
||||
isOwnedBy: Boolean? = null,
|
||||
userRightsInChat: ChatAdministratorRightsImpl? = null,
|
||||
botRightsInChat: ChatAdministratorRightsImpl? = null,
|
||||
userRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botRightsInChat: ChatCommonAdministratorRights? = null,
|
||||
botIsMember: Boolean? = null
|
||||
) = requestChatButton(
|
||||
text,
|
||||
|
Loading…
Reference in New Issue
Block a user