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
|
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.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.members.PromoteChatMember
|
import dev.inmo.tgbotapi.requests.chat.members.PromoteChatMember
|
||||||
import dev.inmo.tgbotapi.types.IdChatIdentifier
|
import dev.inmo.tgbotapi.types.*
|
||||||
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.PublicChat
|
||||||
import dev.inmo.tgbotapi.types.chat.User
|
import dev.inmo.tgbotapi.types.chat.User
|
||||||
|
|
||||||
|
@Warning("This method is too common. Use it with caution")
|
||||||
suspend fun TelegramBot.promoteChatMember(
|
suspend fun TelegramBot.promoteChatMember(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
@ -24,27 +23,34 @@ suspend fun TelegramBot.promoteChatMember(
|
|||||||
canPromoteMembers: Boolean? = null,
|
canPromoteMembers: Boolean? = null,
|
||||||
canManageVideoChats: Boolean? = null,
|
canManageVideoChats: Boolean? = null,
|
||||||
canManageChat: Boolean? = null,
|
canManageChat: Boolean? = null,
|
||||||
canManageTopics: Boolean? = null
|
canManageTopics: Boolean? = null,
|
||||||
|
canPostStories: Boolean? = null,
|
||||||
|
canEditStories: Boolean? = null,
|
||||||
|
canDeleteStories: Boolean? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
PromoteChatMember(
|
PromoteChatMember(
|
||||||
chatId,
|
chatId = chatId,
|
||||||
userId,
|
userId = userId,
|
||||||
untilDate,
|
untilDate = untilDate,
|
||||||
isAnonymous,
|
isAnonymous = isAnonymous,
|
||||||
canChangeInfo,
|
canChangeInfo = canChangeInfo,
|
||||||
canPostMessages,
|
canPostMessages = canPostMessages,
|
||||||
canEditMessages,
|
canEditMessages = canEditMessages,
|
||||||
canDeleteMessages,
|
canDeleteMessages = canDeleteMessages,
|
||||||
canInviteUsers,
|
canInviteUsers = canInviteUsers,
|
||||||
canRestrictMembers,
|
canRestrictMembers = canRestrictMembers,
|
||||||
canPinMessages,
|
canPinMessages = canPinMessages,
|
||||||
canPromoteMembers,
|
canPromoteMembers = canPromoteMembers,
|
||||||
canManageVideoChats,
|
canManageVideoChats = canManageVideoChats,
|
||||||
canManageChat,
|
canManageChat = canManageChat,
|
||||||
canManageTopics
|
canManageTopics = canManageTopics,
|
||||||
|
canPostStories = canPostStories,
|
||||||
|
canEditStories = canEditStories,
|
||||||
|
canDeleteStories = canDeleteStories
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Warning("This method is too common. Use it with caution")
|
||||||
suspend fun TelegramBot.promoteChatMember(
|
suspend fun TelegramBot.promoteChatMember(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
@ -60,25 +66,32 @@ suspend fun TelegramBot.promoteChatMember(
|
|||||||
canPromoteMembers: Boolean? = null,
|
canPromoteMembers: Boolean? = null,
|
||||||
canManageVideoChats: Boolean? = null,
|
canManageVideoChats: Boolean? = null,
|
||||||
canManageChat: Boolean? = null,
|
canManageChat: Boolean? = null,
|
||||||
canManageTopics: Boolean? = null
|
canManageTopics: Boolean? = null,
|
||||||
|
canPostStories: Boolean? = null,
|
||||||
|
canEditStories: Boolean? = null,
|
||||||
|
canDeleteStories: Boolean? = null
|
||||||
) = promoteChatMember(
|
) = promoteChatMember(
|
||||||
chat.id,
|
chat.id,
|
||||||
userId,
|
userId,
|
||||||
untilDate,
|
untilDate = untilDate,
|
||||||
isAnonymous,
|
isAnonymous = isAnonymous,
|
||||||
canChangeInfo,
|
canChangeInfo = canChangeInfo,
|
||||||
canPostMessages,
|
canPostMessages = canPostMessages,
|
||||||
canEditMessages,
|
canEditMessages = canEditMessages,
|
||||||
canDeleteMessages,
|
canDeleteMessages = canDeleteMessages,
|
||||||
canInviteUsers,
|
canInviteUsers = canInviteUsers,
|
||||||
canRestrictMembers,
|
canRestrictMembers = canRestrictMembers,
|
||||||
canPinMessages,
|
canPinMessages = canPinMessages,
|
||||||
canPromoteMembers,
|
canPromoteMembers = canPromoteMembers,
|
||||||
canManageVideoChats,
|
canManageVideoChats = canManageVideoChats,
|
||||||
canManageChat,
|
canManageChat = canManageChat,
|
||||||
canManageTopics
|
canManageTopics = canManageTopics,
|
||||||
|
canPostStories = canPostStories,
|
||||||
|
canEditStories = canEditStories,
|
||||||
|
canDeleteStories = canDeleteStories
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Warning("This method is too common. Use it with caution")
|
||||||
suspend fun TelegramBot.promoteChatMember(
|
suspend fun TelegramBot.promoteChatMember(
|
||||||
chatId: IdChatIdentifier,
|
chatId: IdChatIdentifier,
|
||||||
user: User,
|
user: User,
|
||||||
@ -94,25 +107,32 @@ suspend fun TelegramBot.promoteChatMember(
|
|||||||
canPromoteMembers: Boolean? = null,
|
canPromoteMembers: Boolean? = null,
|
||||||
canManageVideoChats: Boolean? = null,
|
canManageVideoChats: Boolean? = null,
|
||||||
canManageChat: Boolean? = null,
|
canManageChat: Boolean? = null,
|
||||||
canManageTopics: Boolean? = null
|
canManageTopics: Boolean? = null,
|
||||||
|
canPostStories: Boolean? = null,
|
||||||
|
canEditStories: Boolean? = null,
|
||||||
|
canDeleteStories: Boolean? = null
|
||||||
) = promoteChatMember(
|
) = promoteChatMember(
|
||||||
chatId,
|
chatId,
|
||||||
user.id,
|
user.id,
|
||||||
untilDate,
|
untilDate = untilDate,
|
||||||
isAnonymous,
|
isAnonymous = isAnonymous,
|
||||||
canChangeInfo,
|
canChangeInfo = canChangeInfo,
|
||||||
canPostMessages,
|
canPostMessages = canPostMessages,
|
||||||
canEditMessages,
|
canEditMessages = canEditMessages,
|
||||||
canDeleteMessages,
|
canDeleteMessages = canDeleteMessages,
|
||||||
canInviteUsers,
|
canInviteUsers = canInviteUsers,
|
||||||
canRestrictMembers,
|
canRestrictMembers = canRestrictMembers,
|
||||||
canPinMessages,
|
canPinMessages = canPinMessages,
|
||||||
canPromoteMembers,
|
canPromoteMembers = canPromoteMembers,
|
||||||
canManageVideoChats,
|
canManageVideoChats = canManageVideoChats,
|
||||||
canManageChat,
|
canManageChat = canManageChat,
|
||||||
canManageTopics
|
canManageTopics = canManageTopics,
|
||||||
|
canPostStories = canPostStories,
|
||||||
|
canEditStories = canEditStories,
|
||||||
|
canDeleteStories = canDeleteStories
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Warning("This method is too common. Use it with caution")
|
||||||
suspend fun TelegramBot.promoteChatMember(
|
suspend fun TelegramBot.promoteChatMember(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
user: User,
|
user: User,
|
||||||
@ -128,21 +148,27 @@ suspend fun TelegramBot.promoteChatMember(
|
|||||||
canPromoteMembers: Boolean? = null,
|
canPromoteMembers: Boolean? = null,
|
||||||
canManageVideoChats: Boolean? = null,
|
canManageVideoChats: Boolean? = null,
|
||||||
canManageChat: Boolean? = null,
|
canManageChat: Boolean? = null,
|
||||||
canManageTopics: Boolean? = null
|
canManageTopics: Boolean? = null,
|
||||||
|
canPostStories: Boolean? = null,
|
||||||
|
canEditStories: Boolean? = null,
|
||||||
|
canDeleteStories: Boolean? = null
|
||||||
) = promoteChatMember(
|
) = promoteChatMember(
|
||||||
chat.id,
|
chat.id,
|
||||||
user.id,
|
user.id,
|
||||||
untilDate,
|
untilDate = untilDate,
|
||||||
isAnonymous,
|
isAnonymous = isAnonymous,
|
||||||
canChangeInfo,
|
canChangeInfo = canChangeInfo,
|
||||||
canPostMessages,
|
canPostMessages = canPostMessages,
|
||||||
canEditMessages,
|
canEditMessages = canEditMessages,
|
||||||
canDeleteMessages,
|
canDeleteMessages = canDeleteMessages,
|
||||||
canInviteUsers,
|
canInviteUsers = canInviteUsers,
|
||||||
canRestrictMembers,
|
canRestrictMembers = canRestrictMembers,
|
||||||
canPinMessages,
|
canPinMessages = canPinMessages,
|
||||||
canPromoteMembers,
|
canPromoteMembers = canPromoteMembers,
|
||||||
canManageVideoChats,
|
canManageVideoChats = canManageVideoChats,
|
||||||
canManageChat,
|
canManageChat = canManageChat,
|
||||||
canManageTopics
|
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
|
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.abstracts.types.UntilDate
|
||||||
import dev.inmo.tgbotapi.requests.chat.abstracts.ChatMemberRequest
|
import dev.inmo.tgbotapi.requests.chat.abstracts.ChatMemberRequest
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
@ -7,37 +8,44 @@ import kotlinx.serialization.*
|
|||||||
import kotlinx.serialization.builtins.serializer
|
import kotlinx.serialization.builtins.serializer
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
|
@Warning("This method is too common. Use it with caution")
|
||||||
data class PromoteChatMember(
|
data class PromoteChatMember(
|
||||||
@SerialName(chatIdField)
|
@SerialName(chatIdField)
|
||||||
override val chatId: ChatIdentifier,
|
override val chatId: ChatIdentifier,
|
||||||
@SerialName(userIdField)
|
@SerialName(userIdField)
|
||||||
override val userId: UserId,
|
override val userId: UserId,
|
||||||
@SerialName(untilDateField)
|
@SerialName(untilDateField)
|
||||||
override val untilDate: TelegramDate? = null,
|
override val untilDate: TelegramDate?,
|
||||||
@SerialName(isAnonymousField)
|
@SerialName(isAnonymousField)
|
||||||
private val isAnonymous: Boolean? = null,
|
private val isAnonymous: Boolean?,
|
||||||
@SerialName(canChangeInfoField)
|
@SerialName(canChangeInfoField)
|
||||||
private val canChangeInfo: Boolean? = null,
|
private val canChangeInfo: Boolean?,
|
||||||
@SerialName(canPostMessagesField)
|
@SerialName(canPostMessagesField)
|
||||||
private val canPostMessages: Boolean? = null,
|
private val canPostMessages: Boolean?,
|
||||||
@SerialName(canEditMessagesField)
|
@SerialName(canEditMessagesField)
|
||||||
private val canEditMessages: Boolean? = null,
|
private val canEditMessages: Boolean?,
|
||||||
@SerialName(canDeleteMessagesField)
|
@SerialName(canDeleteMessagesField)
|
||||||
private val canDeleteMessages: Boolean? = null,
|
private val canDeleteMessages: Boolean?,
|
||||||
@SerialName(canInviteUsersField)
|
@SerialName(canInviteUsersField)
|
||||||
private val canInviteUsers: Boolean? = null,
|
private val canInviteUsers: Boolean?,
|
||||||
@SerialName(canRestrictMembersField)
|
@SerialName(canRestrictMembersField)
|
||||||
private val canRestrictMembers: Boolean? = null,
|
private val canRestrictMembers: Boolean?,
|
||||||
@SerialName(canPinMessagesField)
|
@SerialName(canPinMessagesField)
|
||||||
private val canPinMessages: Boolean? = null,
|
private val canPinMessages: Boolean?,
|
||||||
@SerialName(canPromoteMembersField)
|
@SerialName(canPromoteMembersField)
|
||||||
private val canPromoteMembers: Boolean? = null,
|
private val canPromoteMembers: Boolean?,
|
||||||
@SerialName(canManageVideoChatsField)
|
@SerialName(canManageVideoChatsField)
|
||||||
private val canManageVideoChats: Boolean? = null,
|
private val canManageVideoChats: Boolean?,
|
||||||
@SerialName(canManageChatField)
|
@SerialName(canManageChatField)
|
||||||
private val canManageChat: Boolean? = null,
|
private val canManageChat: Boolean?,
|
||||||
@SerialName(canManageTopicsField)
|
@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 {
|
) : ChatMemberRequest<Boolean>, UntilDate {
|
||||||
override fun method(): String = "promoteChatMember"
|
override fun method(): String = "promoteChatMember"
|
||||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||||
@ -45,3 +53,109 @@ data class PromoteChatMember(
|
|||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
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