< Summary

Information
Class: TeleFlow.Telegram.Webhooks.Internal.TelegramWebhookUpdateLogFormatter
Assembly: TeleFlow.Telegram.Webhooks
File(s): /_/src/TeleFlow.Telegram.Webhooks/Internal/TelegramWebhookUpdateLogFormatter.cs
Line coverage
7%
Covered lines: 2
Uncovered lines: 25
Coverable lines: 27
Total lines: 42
Line coverage: 7.4%
Branch coverage
2%
Covered branches: 1
Total branches: 50
Branch coverage: 2%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
GetUpdateType(...)2%2035507.4%

File(s)

/_/src/TeleFlow.Telegram.Webhooks/Internal/TelegramWebhookUpdateLogFormatter.cs

#LineLine coverage
 1using TeleFlow.Telegram.Schema.Types;
 2
 3namespace TeleFlow.Telegram.Webhooks.Internal;
 4
 5/// <summary>
 6/// Formats safe Telegram update metadata for webhook diagnostics without reading user message content.
 7/// </summary>
 8internal static class TelegramWebhookUpdateLogFormatter
 9{
 10    public static string GetUpdateType(Update update)
 11    {
 312        ArgumentNullException.ThrowIfNull(update);
 13
 614        if (update.Message is not null) return "message";
 015        if (update.EditedMessage is not null) return "edited_message";
 016        if (update.ChannelPost is not null) return "channel_post";
 017        if (update.EditedChannelPost is not null) return "edited_channel_post";
 018        if (update.BusinessConnection is not null) return "business_connection";
 019        if (update.BusinessMessage is not null) return "business_message";
 020        if (update.EditedBusinessMessage is not null) return "edited_business_message";
 021        if (update.DeletedBusinessMessages is not null) return "deleted_business_messages";
 022        if (update.GuestMessage is not null) return "guest_message";
 023        if (update.MessageReaction is not null) return "message_reaction";
 024        if (update.MessageReactionCount is not null) return "message_reaction_count";
 025        if (update.InlineQuery is not null) return "inline_query";
 026        if (update.ChosenInlineResult is not null) return "chosen_inline_result";
 027        if (update.CallbackQuery is not null) return "callback_query";
 028        if (update.ShippingQuery is not null) return "shipping_query";
 029        if (update.PreCheckoutQuery is not null) return "pre_checkout_query";
 030        if (update.PurchasedPaidMedia is not null) return "purchased_paid_media";
 031        if (update.Poll is not null) return "poll";
 032        if (update.PollAnswer is not null) return "poll_answer";
 033        if (update.MyChatMember is not null) return "my_chat_member";
 034        if (update.ChatMember is not null) return "chat_member";
 035        if (update.ChatJoinRequest is not null) return "chat_join_request";
 036        if (update.ChatBoost is not null) return "chat_boost";
 037        if (update.RemovedChatBoost is not null) return "removed_chat_boost";
 038        if (update.ManagedBot is not null) return "managed_bot";
 39
 040        return "unknown";
 41    }
 42}