mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-24 19:18:44 +00:00
update promoteChatMember
This commit is contained in:
parent
5215e8a315
commit
ccfb774f33
@ -0,0 +1,157 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.chat.members
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.chat.members.PromoteChannelAdministrator
|
||||
import dev.inmo.tgbotapi.requests.chat.members.PromoteChatMember
|
||||
import dev.inmo.tgbotapi.types.IdChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.TelegramDate
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||
import dev.inmo.tgbotapi.types.chat.User
|
||||
|
||||
suspend fun TelegramBot.promoteChannelAdministrator(
|
||||
chatId: ChatIdentifier,
|
||||
userId: UserId,
|
||||
untilDate: TelegramDate? = null,
|
||||
isAnonymous: Boolean? = null,
|
||||
canChangeInfo: Boolean? = null,
|
||||
canPostMessages: Boolean? = null,
|
||||
canEditMessages: Boolean? = null,
|
||||
canDeleteMessages: Boolean? = null,
|
||||
canInviteUsers: Boolean? = null,
|
||||
canRestrictMembers: Boolean? = null,
|
||||
canPromoteMembers: Boolean? = null,
|
||||
canManageVideoChats: Boolean? = null,
|
||||
canManageChat: Boolean? = null,
|
||||
canPostStories: Boolean? = null,
|
||||
canEditStories: Boolean? = null,
|
||||
canDeleteStories: Boolean? = null
|
||||
) = execute(
|
||||
PromoteChannelAdministrator(
|
||||
chatId = chatId,
|
||||
userId = userId,
|
||||
untilDate = untilDate,
|
||||
isAnonymous = isAnonymous,
|
||||
canChangeInfo = canChangeInfo,
|
||||
canPostMessages = canPostMessages,
|
||||
canEditMessages = canEditMessages,
|
||||
canDeleteMessages = canDeleteMessages,
|
||||
canInviteUsers = canInviteUsers,
|
||||
canRestrictMembers = canRestrictMembers,
|
||||
canPromoteMembers = canPromoteMembers,
|
||||
canManageVideoChats = canManageVideoChats,
|
||||
canManageChat = canManageChat,
|
||||
canPostStories = canPostStories,
|
||||
canEditStories = canEditStories,
|
||||
canDeleteStories = canDeleteStories
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.promoteChannelAdministrator(
|
||||
chat: PublicChat,
|
||||
userId: UserId,
|
||||
untilDate: TelegramDate? = null,
|
||||
isAnonymous: Boolean? = null,
|
||||
canChangeInfo: Boolean? = null,
|
||||
canPostMessages: Boolean? = null,
|
||||
canEditMessages: Boolean? = null,
|
||||
canDeleteMessages: Boolean? = null,
|
||||
canInviteUsers: Boolean? = null,
|
||||
canRestrictMembers: Boolean? = null,
|
||||
canPromoteMembers: Boolean? = null,
|
||||
canManageVideoChats: Boolean? = null,
|
||||
canManageChat: Boolean? = null,
|
||||
canPostStories: Boolean? = null,
|
||||
canEditStories: Boolean? = null,
|
||||
canDeleteStories: Boolean? = null
|
||||
) = promoteChannelAdministrator(
|
||||
chat.id,
|
||||
userId,
|
||||
untilDate = untilDate,
|
||||
isAnonymous = isAnonymous,
|
||||
canChangeInfo = canChangeInfo,
|
||||
canPostMessages = canPostMessages,
|
||||
canEditMessages = canEditMessages,
|
||||
canDeleteMessages = canDeleteMessages,
|
||||
canInviteUsers = canInviteUsers,
|
||||
canRestrictMembers = canRestrictMembers,
|
||||
canPromoteMembers = canPromoteMembers,
|
||||
canManageVideoChats = canManageVideoChats,
|
||||
canManageChat = canManageChat,
|
||||
canPostStories = canPostStories,
|
||||
canEditStories = canEditStories,
|
||||
canDeleteStories = canDeleteStories
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.promoteChannelAdministrator(
|
||||
chatId: IdChatIdentifier,
|
||||
user: User,
|
||||
untilDate: TelegramDate? = null,
|
||||
isAnonymous: Boolean? = null,
|
||||
canChangeInfo: Boolean? = null,
|
||||
canPostMessages: Boolean? = null,
|
||||
canEditMessages: Boolean? = null,
|
||||
canDeleteMessages: Boolean? = null,
|
||||
canInviteUsers: Boolean? = null,
|
||||
canRestrictMembers: Boolean? = null,
|
||||
canPromoteMembers: Boolean? = null,
|
||||
canManageVideoChats: Boolean? = null,
|
||||
canManageChat: Boolean? = null,
|
||||
canPostStories: Boolean? = null,
|
||||
canEditStories: Boolean? = null,
|
||||
canDeleteStories: Boolean? = null
|
||||
) = promoteChannelAdministrator(
|
||||
chatId,
|
||||
user.id,
|
||||
untilDate = untilDate,
|
||||
isAnonymous = isAnonymous,
|
||||
canChangeInfo = canChangeInfo,
|
||||
canPostMessages = canPostMessages,
|
||||
canEditMessages = canEditMessages,
|
||||
canDeleteMessages = canDeleteMessages,
|
||||
canInviteUsers = canInviteUsers,
|
||||
canRestrictMembers = canRestrictMembers,
|
||||
canPromoteMembers = canPromoteMembers,
|
||||
canManageVideoChats = canManageVideoChats,
|
||||
canManageChat = canManageChat,
|
||||
canPostStories = canPostStories,
|
||||
canEditStories = canEditStories,
|
||||
canDeleteStories = canDeleteStories
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.promoteChannelAdministrator(
|
||||
chat: PublicChat,
|
||||
user: User,
|
||||
untilDate: TelegramDate? = null,
|
||||
isAnonymous: Boolean? = null,
|
||||
canChangeInfo: Boolean? = null,
|
||||
canPostMessages: Boolean? = null,
|
||||
canEditMessages: Boolean? = null,
|
||||
canDeleteMessages: Boolean? = null,
|
||||
canInviteUsers: Boolean? = null,
|
||||
canRestrictMembers: Boolean? = null,
|
||||
canPromoteMembers: Boolean? = null,
|
||||
canManageVideoChats: Boolean? = null,
|
||||
canManageChat: Boolean? = null,
|
||||
canPostStories: Boolean? = null,
|
||||
canEditStories: Boolean? = null,
|
||||
canDeleteStories: Boolean? = null
|
||||
) = promoteChannelAdministrator(
|
||||
chat.id,
|
||||
user.id,
|
||||
untilDate = untilDate,
|
||||
isAnonymous = isAnonymous,
|
||||
canChangeInfo = canChangeInfo,
|
||||
canPostMessages = canPostMessages,
|
||||
canEditMessages = canEditMessages,
|
||||
canDeleteMessages = canDeleteMessages,
|
||||
canInviteUsers = canInviteUsers,
|
||||
canRestrictMembers = canRestrictMembers,
|
||||
canPromoteMembers = canPromoteMembers,
|
||||
canManageVideoChats = canManageVideoChats,
|
||||
canManageChat = canManageChat,
|
||||
canPostStories = canPostStories,
|
||||
canEditStories = canEditStories,
|
||||
canDeleteStories = canDeleteStories
|
||||
)
|
@ -0,0 +1,116 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.chat.members
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.chat.members.PromoteChatMember
|
||||
import dev.inmo.tgbotapi.types.IdChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.TelegramDate
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||
import dev.inmo.tgbotapi.types.chat.User
|
||||
|
||||
suspend fun TelegramBot.promoteChatAdministrator(
|
||||
chatId: ChatIdentifier,
|
||||
userId: UserId,
|
||||
untilDate: TelegramDate? = null,
|
||||
isAnonymous: Boolean? = null,
|
||||
canChangeInfo: Boolean? = null,
|
||||
canDeleteMessages: Boolean? = null,
|
||||
canInviteUsers: Boolean? = null,
|
||||
canRestrictMembers: Boolean? = null,
|
||||
canPromoteMembers: Boolean? = null,
|
||||
canManageVideoChats: Boolean? = null,
|
||||
canManageChat: Boolean? = null,
|
||||
) = execute(
|
||||
PromoteChatMember(
|
||||
chatId,
|
||||
userId,
|
||||
untilDate,
|
||||
isAnonymous,
|
||||
canChangeInfo,
|
||||
canDeleteMessages,
|
||||
canInviteUsers,
|
||||
canRestrictMembers,
|
||||
canPromoteMembers,
|
||||
canManageVideoChats,
|
||||
canManageChat
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.promoteChatAdministrator(
|
||||
chat: PublicChat,
|
||||
userId: UserId,
|
||||
untilDate: TelegramDate? = null,
|
||||
isAnonymous: Boolean? = null,
|
||||
canChangeInfo: Boolean? = null,
|
||||
canDeleteMessages: Boolean? = null,
|
||||
canInviteUsers: Boolean? = null,
|
||||
canRestrictMembers: Boolean? = null,
|
||||
canPromoteMembers: Boolean? = null,
|
||||
canManageVideoChats: Boolean? = null,
|
||||
canManageChat: Boolean? = null,
|
||||
) = promoteChatAdministrator(
|
||||
chat.id,
|
||||
userId,
|
||||
untilDate,
|
||||
isAnonymous,
|
||||
canChangeInfo,
|
||||
canDeleteMessages,
|
||||
canInviteUsers,
|
||||
canRestrictMembers,
|
||||
canPromoteMembers,
|
||||
canManageVideoChats,
|
||||
canManageChat
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.promoteChatAdministrator(
|
||||
chatId: IdChatIdentifier,
|
||||
user: User,
|
||||
untilDate: TelegramDate? = null,
|
||||
isAnonymous: Boolean? = null,
|
||||
canChangeInfo: Boolean? = null,
|
||||
canDeleteMessages: Boolean? = null,
|
||||
canInviteUsers: Boolean? = null,
|
||||
canRestrictMembers: Boolean? = null,
|
||||
canPromoteMembers: Boolean? = null,
|
||||
canManageVideoChats: Boolean? = null,
|
||||
canManageChat: Boolean? = null,
|
||||
) = promoteChatAdministrator(
|
||||
chatId,
|
||||
user.id,
|
||||
untilDate,
|
||||
isAnonymous,
|
||||
canChangeInfo,
|
||||
canDeleteMessages,
|
||||
canInviteUsers,
|
||||
canRestrictMembers,
|
||||
canPromoteMembers,
|
||||
canManageVideoChats,
|
||||
canManageChat
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.promoteChatAdministrator(
|
||||
chat: PublicChat,
|
||||
user: User,
|
||||
untilDate: TelegramDate? = null,
|
||||
isAnonymous: Boolean? = null,
|
||||
canChangeInfo: Boolean? = null,
|
||||
canDeleteMessages: Boolean? = null,
|
||||
canInviteUsers: Boolean? = null,
|
||||
canRestrictMembers: Boolean? = null,
|
||||
canPromoteMembers: Boolean? = null,
|
||||
canManageVideoChats: Boolean? = null,
|
||||
canManageChat: Boolean? = null,
|
||||
) = promoteChatAdministrator(
|
||||
chat.id,
|
||||
user.id,
|
||||
untilDate,
|
||||
isAnonymous,
|
||||
canChangeInfo,
|
||||
canDeleteMessages,
|
||||
canInviteUsers,
|
||||
canRestrictMembers,
|
||||
canPromoteMembers,
|
||||
canManageVideoChats,
|
||||
canManageChat
|
||||
)
|
@ -1,14 +1,13 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.chat.members
|
||||
|
||||
import dev.inmo.micro_utils.common.Warning
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.chat.members.PromoteChatMember
|
||||
import dev.inmo.tgbotapi.types.IdChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.TelegramDate
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||
import dev.inmo.tgbotapi.types.chat.User
|
||||
|
||||
@Warning("This method is too common. Use it with caution")
|
||||
suspend fun TelegramBot.promoteChatMember(
|
||||
chatId: ChatIdentifier,
|
||||
userId: UserId,
|
||||
@ -24,27 +23,34 @@ suspend fun TelegramBot.promoteChatMember(
|
||||
canPromoteMembers: Boolean? = null,
|
||||
canManageVideoChats: Boolean? = null,
|
||||
canManageChat: Boolean? = null,
|
||||
canManageTopics: Boolean? = null
|
||||
canManageTopics: Boolean? = null,
|
||||
canPostStories: Boolean? = null,
|
||||
canEditStories: Boolean? = null,
|
||||
canDeleteStories: Boolean? = null
|
||||
) = execute(
|
||||
PromoteChatMember(
|
||||
chatId,
|
||||
userId,
|
||||
untilDate,
|
||||
isAnonymous,
|
||||
canChangeInfo,
|
||||
canPostMessages,
|
||||
canEditMessages,
|
||||
canDeleteMessages,
|
||||
canInviteUsers,
|
||||
canRestrictMembers,
|
||||
canPinMessages,
|
||||
canPromoteMembers,
|
||||
canManageVideoChats,
|
||||
canManageChat,
|
||||
canManageTopics
|
||||
chatId = chatId,
|
||||
userId = userId,
|
||||
untilDate = untilDate,
|
||||
isAnonymous = isAnonymous,
|
||||
canChangeInfo = canChangeInfo,
|
||||
canPostMessages = canPostMessages,
|
||||
canEditMessages = canEditMessages,
|
||||
canDeleteMessages = canDeleteMessages,
|
||||
canInviteUsers = canInviteUsers,
|
||||
canRestrictMembers = canRestrictMembers,
|
||||
canPinMessages = canPinMessages,
|
||||
canPromoteMembers = canPromoteMembers,
|
||||
canManageVideoChats = canManageVideoChats,
|
||||
canManageChat = canManageChat,
|
||||
canManageTopics = canManageTopics,
|
||||
canPostStories = canPostStories,
|
||||
canEditStories = canEditStories,
|
||||
canDeleteStories = canDeleteStories
|
||||
)
|
||||
)
|
||||
|
||||
@Warning("This method is too common. Use it with caution")
|
||||
suspend fun TelegramBot.promoteChatMember(
|
||||
chat: PublicChat,
|
||||
userId: UserId,
|
||||
@ -60,25 +66,32 @@ suspend fun TelegramBot.promoteChatMember(
|
||||
canPromoteMembers: Boolean? = null,
|
||||
canManageVideoChats: Boolean? = null,
|
||||
canManageChat: Boolean? = null,
|
||||
canManageTopics: Boolean? = null
|
||||
canManageTopics: Boolean? = null,
|
||||
canPostStories: Boolean? = null,
|
||||
canEditStories: Boolean? = null,
|
||||
canDeleteStories: Boolean? = null
|
||||
) = promoteChatMember(
|
||||
chat.id,
|
||||
userId,
|
||||
untilDate,
|
||||
isAnonymous,
|
||||
canChangeInfo,
|
||||
canPostMessages,
|
||||
canEditMessages,
|
||||
canDeleteMessages,
|
||||
canInviteUsers,
|
||||
canRestrictMembers,
|
||||
canPinMessages,
|
||||
canPromoteMembers,
|
||||
canManageVideoChats,
|
||||
canManageChat,
|
||||
canManageTopics
|
||||
untilDate = untilDate,
|
||||
isAnonymous = isAnonymous,
|
||||
canChangeInfo = canChangeInfo,
|
||||
canPostMessages = canPostMessages,
|
||||
canEditMessages = canEditMessages,
|
||||
canDeleteMessages = canDeleteMessages,
|
||||
canInviteUsers = canInviteUsers,
|
||||
canRestrictMembers = canRestrictMembers,
|
||||
canPinMessages = canPinMessages,
|
||||
canPromoteMembers = canPromoteMembers,
|
||||
canManageVideoChats = canManageVideoChats,
|
||||
canManageChat = canManageChat,
|
||||
canManageTopics = canManageTopics,
|
||||
canPostStories = canPostStories,
|
||||
canEditStories = canEditStories,
|
||||
canDeleteStories = canDeleteStories
|
||||
)
|
||||
|
||||
@Warning("This method is too common. Use it with caution")
|
||||
suspend fun TelegramBot.promoteChatMember(
|
||||
chatId: IdChatIdentifier,
|
||||
user: User,
|
||||
@ -94,25 +107,32 @@ suspend fun TelegramBot.promoteChatMember(
|
||||
canPromoteMembers: Boolean? = null,
|
||||
canManageVideoChats: Boolean? = null,
|
||||
canManageChat: Boolean? = null,
|
||||
canManageTopics: Boolean? = null
|
||||
canManageTopics: Boolean? = null,
|
||||
canPostStories: Boolean? = null,
|
||||
canEditStories: Boolean? = null,
|
||||
canDeleteStories: Boolean? = null
|
||||
) = promoteChatMember(
|
||||
chatId,
|
||||
user.id,
|
||||
untilDate,
|
||||
isAnonymous,
|
||||
canChangeInfo,
|
||||
canPostMessages,
|
||||
canEditMessages,
|
||||
canDeleteMessages,
|
||||
canInviteUsers,
|
||||
canRestrictMembers,
|
||||
canPinMessages,
|
||||
canPromoteMembers,
|
||||
canManageVideoChats,
|
||||
canManageChat,
|
||||
canManageTopics
|
||||
untilDate = untilDate,
|
||||
isAnonymous = isAnonymous,
|
||||
canChangeInfo = canChangeInfo,
|
||||
canPostMessages = canPostMessages,
|
||||
canEditMessages = canEditMessages,
|
||||
canDeleteMessages = canDeleteMessages,
|
||||
canInviteUsers = canInviteUsers,
|
||||
canRestrictMembers = canRestrictMembers,
|
||||
canPinMessages = canPinMessages,
|
||||
canPromoteMembers = canPromoteMembers,
|
||||
canManageVideoChats = canManageVideoChats,
|
||||
canManageChat = canManageChat,
|
||||
canManageTopics = canManageTopics,
|
||||
canPostStories = canPostStories,
|
||||
canEditStories = canEditStories,
|
||||
canDeleteStories = canDeleteStories
|
||||
)
|
||||
|
||||
@Warning("This method is too common. Use it with caution")
|
||||
suspend fun TelegramBot.promoteChatMember(
|
||||
chat: PublicChat,
|
||||
user: User,
|
||||
@ -128,21 +148,27 @@ suspend fun TelegramBot.promoteChatMember(
|
||||
canPromoteMembers: Boolean? = null,
|
||||
canManageVideoChats: Boolean? = null,
|
||||
canManageChat: Boolean? = null,
|
||||
canManageTopics: Boolean? = null
|
||||
canManageTopics: Boolean? = null,
|
||||
canPostStories: Boolean? = null,
|
||||
canEditStories: Boolean? = null,
|
||||
canDeleteStories: Boolean? = null
|
||||
) = promoteChatMember(
|
||||
chat.id,
|
||||
user.id,
|
||||
untilDate,
|
||||
isAnonymous,
|
||||
canChangeInfo,
|
||||
canPostMessages,
|
||||
canEditMessages,
|
||||
canDeleteMessages,
|
||||
canInviteUsers,
|
||||
canRestrictMembers,
|
||||
canPinMessages,
|
||||
canPromoteMembers,
|
||||
canManageVideoChats,
|
||||
canManageChat,
|
||||
canManageTopics
|
||||
untilDate = untilDate,
|
||||
isAnonymous = isAnonymous,
|
||||
canChangeInfo = canChangeInfo,
|
||||
canPostMessages = canPostMessages,
|
||||
canEditMessages = canEditMessages,
|
||||
canDeleteMessages = canDeleteMessages,
|
||||
canInviteUsers = canInviteUsers,
|
||||
canRestrictMembers = canRestrictMembers,
|
||||
canPinMessages = canPinMessages,
|
||||
canPromoteMembers = canPromoteMembers,
|
||||
canManageVideoChats = canManageVideoChats,
|
||||
canManageChat = canManageChat,
|
||||
canManageTopics = canManageTopics,
|
||||
canPostStories = canPostStories,
|
||||
canEditStories = canEditStories,
|
||||
canDeleteStories = canDeleteStories
|
||||
)
|
||||
|
@ -0,0 +1,133 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.chat.members
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.chat.members.PromoteChatMember
|
||||
import dev.inmo.tgbotapi.requests.chat.members.PromoteSupergroupAdministrator
|
||||
import dev.inmo.tgbotapi.types.IdChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.TelegramDate
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||
import dev.inmo.tgbotapi.types.chat.User
|
||||
|
||||
suspend fun TelegramBot.promoteSupergroupAdministrator(
|
||||
chatId: ChatIdentifier,
|
||||
userId: UserId,
|
||||
untilDate: TelegramDate? = null,
|
||||
isAnonymous: Boolean? = null,
|
||||
canChangeInfo: Boolean? = null,
|
||||
canDeleteMessages: Boolean? = null,
|
||||
canInviteUsers: Boolean? = null,
|
||||
canRestrictMembers: Boolean? = null,
|
||||
canPinMessages: Boolean? = null,
|
||||
canPromoteMembers: Boolean? = null,
|
||||
canManageVideoChats: Boolean? = null,
|
||||
canManageChat: Boolean? = null,
|
||||
canManageTopics: Boolean? = null,
|
||||
) = execute(
|
||||
PromoteSupergroupAdministrator(
|
||||
chatId = chatId,
|
||||
userId = userId,
|
||||
untilDate = untilDate,
|
||||
isAnonymous = isAnonymous,
|
||||
canChangeInfo = canChangeInfo,
|
||||
canDeleteMessages = canDeleteMessages,
|
||||
canInviteUsers = canInviteUsers,
|
||||
canRestrictMembers = canRestrictMembers,
|
||||
canPinMessages = canPinMessages,
|
||||
canPromoteMembers = canPromoteMembers,
|
||||
canManageVideoChats = canManageVideoChats,
|
||||
canManageChat = canManageChat,
|
||||
canManageTopics = canManageTopics
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.promoteSupergroupAdministrator(
|
||||
chat: PublicChat,
|
||||
userId: UserId,
|
||||
untilDate: TelegramDate? = null,
|
||||
isAnonymous: Boolean? = null,
|
||||
canChangeInfo: Boolean? = null,
|
||||
canDeleteMessages: Boolean? = null,
|
||||
canInviteUsers: Boolean? = null,
|
||||
canRestrictMembers: Boolean? = null,
|
||||
canPinMessages: Boolean? = null,
|
||||
canPromoteMembers: Boolean? = null,
|
||||
canManageVideoChats: Boolean? = null,
|
||||
canManageChat: Boolean? = null,
|
||||
canManageTopics: Boolean? = null,
|
||||
) = promoteSupergroupAdministrator(
|
||||
chat.id,
|
||||
userId,
|
||||
untilDate = untilDate,
|
||||
isAnonymous = isAnonymous,
|
||||
canChangeInfo = canChangeInfo,
|
||||
canDeleteMessages = canDeleteMessages,
|
||||
canInviteUsers = canInviteUsers,
|
||||
canRestrictMembers = canRestrictMembers,
|
||||
canPinMessages = canPinMessages,
|
||||
canPromoteMembers = canPromoteMembers,
|
||||
canManageVideoChats = canManageVideoChats,
|
||||
canManageChat = canManageChat,
|
||||
canManageTopics = canManageTopics
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.promoteSupergroupAdministrator(
|
||||
chatId: IdChatIdentifier,
|
||||
user: User,
|
||||
untilDate: TelegramDate? = null,
|
||||
isAnonymous: Boolean? = null,
|
||||
canChangeInfo: Boolean? = null,
|
||||
canDeleteMessages: Boolean? = null,
|
||||
canInviteUsers: Boolean? = null,
|
||||
canRestrictMembers: Boolean? = null,
|
||||
canPinMessages: Boolean? = null,
|
||||
canPromoteMembers: Boolean? = null,
|
||||
canManageVideoChats: Boolean? = null,
|
||||
canManageChat: Boolean? = null,
|
||||
canManageTopics: Boolean? = null,
|
||||
) = promoteSupergroupAdministrator(
|
||||
chatId,
|
||||
user.id,
|
||||
untilDate = untilDate,
|
||||
isAnonymous = isAnonymous,
|
||||
canChangeInfo = canChangeInfo,
|
||||
canDeleteMessages = canDeleteMessages,
|
||||
canInviteUsers = canInviteUsers,
|
||||
canRestrictMembers = canRestrictMembers,
|
||||
canPinMessages = canPinMessages,
|
||||
canPromoteMembers = canPromoteMembers,
|
||||
canManageVideoChats = canManageVideoChats,
|
||||
canManageChat = canManageChat,
|
||||
canManageTopics = canManageTopics
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.promoteSupergroupAdministrator(
|
||||
chat: PublicChat,
|
||||
user: User,
|
||||
untilDate: TelegramDate? = null,
|
||||
isAnonymous: Boolean? = null,
|
||||
canChangeInfo: Boolean? = null,
|
||||
canDeleteMessages: Boolean? = null,
|
||||
canInviteUsers: Boolean? = null,
|
||||
canRestrictMembers: Boolean? = null,
|
||||
canPinMessages: Boolean? = null,
|
||||
canPromoteMembers: Boolean? = null,
|
||||
canManageVideoChats: Boolean? = null,
|
||||
canManageChat: Boolean? = null,
|
||||
canManageTopics: Boolean? = null,
|
||||
) = promoteSupergroupAdministrator(
|
||||
chat.id,
|
||||
user.id,
|
||||
untilDate = untilDate,
|
||||
isAnonymous = isAnonymous,
|
||||
canChangeInfo = canChangeInfo,
|
||||
canDeleteMessages = canDeleteMessages,
|
||||
canInviteUsers = canInviteUsers,
|
||||
canRestrictMembers = canRestrictMembers,
|
||||
canPinMessages = canPinMessages,
|
||||
canPromoteMembers = canPromoteMembers,
|
||||
canManageVideoChats = canManageVideoChats,
|
||||
canManageChat = canManageChat,
|
||||
canManageTopics = canManageTopics
|
||||
)
|
@ -1,5 +1,6 @@
|
||||
package dev.inmo.tgbotapi.requests.chat.members
|
||||
|
||||
import dev.inmo.micro_utils.common.Warning
|
||||
import dev.inmo.tgbotapi.abstracts.types.UntilDate
|
||||
import dev.inmo.tgbotapi.requests.chat.abstracts.ChatMemberRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
@ -7,37 +8,44 @@ import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@Serializable
|
||||
@Warning("This method is too common. Use it with caution")
|
||||
data class PromoteChatMember(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(untilDateField)
|
||||
override val untilDate: TelegramDate? = null,
|
||||
override val untilDate: TelegramDate?,
|
||||
@SerialName(isAnonymousField)
|
||||
private val isAnonymous: Boolean? = null,
|
||||
private val isAnonymous: Boolean?,
|
||||
@SerialName(canChangeInfoField)
|
||||
private val canChangeInfo: Boolean? = null,
|
||||
private val canChangeInfo: Boolean?,
|
||||
@SerialName(canPostMessagesField)
|
||||
private val canPostMessages: Boolean? = null,
|
||||
private val canPostMessages: Boolean?,
|
||||
@SerialName(canEditMessagesField)
|
||||
private val canEditMessages: Boolean? = null,
|
||||
private val canEditMessages: Boolean?,
|
||||
@SerialName(canDeleteMessagesField)
|
||||
private val canDeleteMessages: Boolean? = null,
|
||||
private val canDeleteMessages: Boolean?,
|
||||
@SerialName(canInviteUsersField)
|
||||
private val canInviteUsers: Boolean? = null,
|
||||
private val canInviteUsers: Boolean?,
|
||||
@SerialName(canRestrictMembersField)
|
||||
private val canRestrictMembers: Boolean? = null,
|
||||
private val canRestrictMembers: Boolean?,
|
||||
@SerialName(canPinMessagesField)
|
||||
private val canPinMessages: Boolean? = null,
|
||||
private val canPinMessages: Boolean?,
|
||||
@SerialName(canPromoteMembersField)
|
||||
private val canPromoteMembers: Boolean? = null,
|
||||
private val canPromoteMembers: Boolean?,
|
||||
@SerialName(canManageVideoChatsField)
|
||||
private val canManageVideoChats: Boolean? = null,
|
||||
private val canManageVideoChats: Boolean?,
|
||||
@SerialName(canManageChatField)
|
||||
private val canManageChat: Boolean? = null,
|
||||
private val canManageChat: Boolean?,
|
||||
@SerialName(canManageTopicsField)
|
||||
private val canManageTopics: Boolean? = null
|
||||
private val canManageTopics: Boolean?,
|
||||
@SerialName(canPostStoriesField)
|
||||
private val canPostStories: Boolean?,
|
||||
@SerialName(canEditStoriesField)
|
||||
private val canEditStories: Boolean?,
|
||||
@SerialName(canDeleteStoriesField)
|
||||
private val canDeleteStories: Boolean?
|
||||
) : ChatMemberRequest<Boolean>, UntilDate {
|
||||
override fun method(): String = "promoteChatMember"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
@ -45,3 +53,109 @@ data class PromoteChatMember(
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
fun PromoteChatMember(
|
||||
chatId: ChatIdentifier,
|
||||
userId: UserId,
|
||||
untilDate: TelegramDate? = null,
|
||||
isAnonymous: Boolean? = null,
|
||||
canChangeInfo: Boolean? = null,
|
||||
canDeleteMessages: Boolean? = null,
|
||||
canInviteUsers: Boolean? = null,
|
||||
canRestrictMembers: Boolean? = null,
|
||||
canPromoteMembers: Boolean? = null,
|
||||
canManageVideoChats: Boolean? = null,
|
||||
canManageChat: Boolean? = null,
|
||||
) = PromoteChatMember(
|
||||
chatId = chatId,
|
||||
userId = userId,
|
||||
untilDate = untilDate,
|
||||
isAnonymous = isAnonymous,
|
||||
canChangeInfo = canChangeInfo,
|
||||
canPostMessages = null,
|
||||
canEditMessages = null,
|
||||
canDeleteMessages = canDeleteMessages,
|
||||
canInviteUsers = canInviteUsers,
|
||||
canRestrictMembers = canRestrictMembers,
|
||||
canPinMessages = null,
|
||||
canPromoteMembers = canPromoteMembers,
|
||||
canManageVideoChats = canManageVideoChats,
|
||||
canManageChat = canManageChat,
|
||||
canManageTopics = null,
|
||||
canPostStories = null,
|
||||
canEditStories = null,
|
||||
canDeleteStories = null
|
||||
)
|
||||
|
||||
fun PromoteChannelAdministrator(
|
||||
chatId: ChatIdentifier,
|
||||
userId: UserId,
|
||||
untilDate: TelegramDate? = null,
|
||||
isAnonymous: Boolean? = null,
|
||||
canChangeInfo: Boolean? = null,
|
||||
canPostMessages: Boolean? = null,
|
||||
canEditMessages: Boolean? = null,
|
||||
canDeleteMessages: Boolean? = null,
|
||||
canInviteUsers: Boolean? = null,
|
||||
canRestrictMembers: Boolean? = null,
|
||||
canPromoteMembers: Boolean? = null,
|
||||
canManageVideoChats: Boolean? = null,
|
||||
canManageChat: Boolean? = null,
|
||||
canPostStories: Boolean? = null,
|
||||
canEditStories: Boolean? = null,
|
||||
canDeleteStories: Boolean? = null
|
||||
) = PromoteChatMember(
|
||||
chatId = chatId,
|
||||
userId = userId,
|
||||
untilDate = untilDate,
|
||||
isAnonymous = isAnonymous,
|
||||
canChangeInfo = canChangeInfo,
|
||||
canPostMessages = canPostMessages,
|
||||
canEditMessages = canEditMessages,
|
||||
canDeleteMessages = canDeleteMessages,
|
||||
canInviteUsers = canInviteUsers,
|
||||
canRestrictMembers = canRestrictMembers,
|
||||
canPinMessages = null,
|
||||
canPromoteMembers = canPromoteMembers,
|
||||
canManageVideoChats = canManageVideoChats,
|
||||
canManageChat = canManageChat,
|
||||
canManageTopics = null,
|
||||
canPostStories = canPostStories,
|
||||
canEditStories = canEditStories,
|
||||
canDeleteStories = canDeleteStories
|
||||
)
|
||||
|
||||
fun PromoteSupergroupAdministrator(
|
||||
chatId: ChatIdentifier,
|
||||
userId: UserId,
|
||||
untilDate: TelegramDate? = null,
|
||||
isAnonymous: Boolean? = null,
|
||||
canChangeInfo: Boolean? = null,
|
||||
canDeleteMessages: Boolean? = null,
|
||||
canInviteUsers: Boolean? = null,
|
||||
canRestrictMembers: Boolean? = null,
|
||||
canPinMessages: Boolean? = null,
|
||||
canPromoteMembers: Boolean? = null,
|
||||
canManageVideoChats: Boolean? = null,
|
||||
canManageChat: Boolean? = null,
|
||||
canManageTopics: Boolean? = null,
|
||||
) = PromoteChatMember(
|
||||
chatId = chatId,
|
||||
userId = userId,
|
||||
untilDate = untilDate,
|
||||
isAnonymous = isAnonymous,
|
||||
canChangeInfo = canChangeInfo,
|
||||
canPostMessages = null,
|
||||
canEditMessages = null,
|
||||
canDeleteMessages = canDeleteMessages,
|
||||
canInviteUsers = canInviteUsers,
|
||||
canRestrictMembers = canRestrictMembers,
|
||||
canPinMessages = canPinMessages,
|
||||
canPromoteMembers = canPromoteMembers,
|
||||
canManageVideoChats = canManageVideoChats,
|
||||
canManageChat = canManageChat,
|
||||
canManageTopics = canManageTopics,
|
||||
canPostStories = null,
|
||||
canEditStories = null,
|
||||
canDeleteStories = null
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user