Exemplo n.º 1
0
 private ChatType MapChatType(Telegram.Bot.Types.Enums.ChatType chatType)
 {
     return(chatType switch
     {
         Telegram.Bot.Types.Enums.ChatType.Private => ChatType.Private,
         Telegram.Bot.Types.Enums.ChatType.Group => ChatType.Group,
         Telegram.Bot.Types.Enums.ChatType.Channel => ChatType.Channel,
         Telegram.Bot.Types.Enums.ChatType.Supergroup => ChatType.Supergroup,
         _ => throw new NotImplementedException($"{nameof(ChatType)} {chatType} is not implemented in the {nameof(ChatMappingProfile)}.")
     });
Exemplo n.º 2
0
        public static ChatType FromTelegramChatType(Telegram.Bot.Types.Enums.ChatType type)
        {
            switch (type)
            {
            case Telegram.Bot.Types.Enums.ChatType.Channel:
                return(ChatType.Channel);

            case Telegram.Bot.Types.Enums.ChatType.Group:
                return(ChatType.Group);

            case Telegram.Bot.Types.Enums.ChatType.Private:
                return(ChatType.Private);

            case Telegram.Bot.Types.Enums.ChatType.Supergroup:
                return(ChatType.Supergroup);

            default:
                return(ChatType.Unknown);
            }
        }