Telegram.Bot icon indicating copy to clipboard operation
Telegram.Bot copied to clipboard

Add chat-specific overloads for PromoteChatMemberAsync

Open karb0f0s opened this issue 4 years ago • 2 comments

promoteChatMember method has subset of options, related only to specific chat types: can_pin_messages - ... supergroups only, can_edit_messages - ... channels only. Maybe we can add overloaded methods with specific subset of options:

// Channel-specific overload
public Task PromoteChatMemberAsync(
            this ITelegramBotClient botClient,
            ChatId chatId,
            long userId,
            ChannelPermissions channelPermissions,
            CancellationToken cancellationToken = default
        );

// Supergroup-specific overload
public Task PromoteChatMemberAsync(
            this ITelegramBotClient botClient,
            ChatId chatId,
            long userId,
            SupoergroupPermissions supergrouplPermissions,
            CancellationToken cancellationToken = default
        );

karb0f0s avatar Jan 28 '22 07:01 karb0f0s

This feature goes against our rule to stick to type hierarchy from the Bot API docs. In the docs ChatPermissions object doesn't have a hierarchy split between different types of chats so we shouldn't assume it.

tuscen avatar Mar 01 '22 15:03 tuscen

Though we can ask Telegram to do the same thing as they did with ChatMember object, i.e. to split it officialy in the docs.

tuscen avatar Mar 01 '22 15:03 tuscen