| | | 1 | | using TeleFlow.Telegram.Schema.Types; |
| | | 2 | | |
| | | 3 | | namespace TeleFlow.Telegram.Webhooks.Internal; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Formats safe Telegram update metadata for webhook diagnostics without reading user message content. |
| | | 7 | | /// </summary> |
| | | 8 | | internal static class TelegramWebhookUpdateLogFormatter |
| | | 9 | | { |
| | | 10 | | public static string GetUpdateType(Update update) |
| | | 11 | | { |
| | 3 | 12 | | ArgumentNullException.ThrowIfNull(update); |
| | | 13 | | |
| | 6 | 14 | | if (update.Message is not null) return "message"; |
| | 0 | 15 | | if (update.EditedMessage is not null) return "edited_message"; |
| | 0 | 16 | | if (update.ChannelPost is not null) return "channel_post"; |
| | 0 | 17 | | if (update.EditedChannelPost is not null) return "edited_channel_post"; |
| | 0 | 18 | | if (update.BusinessConnection is not null) return "business_connection"; |
| | 0 | 19 | | if (update.BusinessMessage is not null) return "business_message"; |
| | 0 | 20 | | if (update.EditedBusinessMessage is not null) return "edited_business_message"; |
| | 0 | 21 | | if (update.DeletedBusinessMessages is not null) return "deleted_business_messages"; |
| | 0 | 22 | | if (update.GuestMessage is not null) return "guest_message"; |
| | 0 | 23 | | if (update.MessageReaction is not null) return "message_reaction"; |
| | 0 | 24 | | if (update.MessageReactionCount is not null) return "message_reaction_count"; |
| | 0 | 25 | | if (update.InlineQuery is not null) return "inline_query"; |
| | 0 | 26 | | if (update.ChosenInlineResult is not null) return "chosen_inline_result"; |
| | 0 | 27 | | if (update.CallbackQuery is not null) return "callback_query"; |
| | 0 | 28 | | if (update.ShippingQuery is not null) return "shipping_query"; |
| | 0 | 29 | | if (update.PreCheckoutQuery is not null) return "pre_checkout_query"; |
| | 0 | 30 | | if (update.PurchasedPaidMedia is not null) return "purchased_paid_media"; |
| | 0 | 31 | | if (update.Poll is not null) return "poll"; |
| | 0 | 32 | | if (update.PollAnswer is not null) return "poll_answer"; |
| | 0 | 33 | | if (update.MyChatMember is not null) return "my_chat_member"; |
| | 0 | 34 | | if (update.ChatMember is not null) return "chat_member"; |
| | 0 | 35 | | if (update.ChatJoinRequest is not null) return "chat_join_request"; |
| | 0 | 36 | | if (update.ChatBoost is not null) return "chat_boost"; |
| | 0 | 37 | | if (update.RemovedChatBoost is not null) return "removed_chat_boost"; |
| | 0 | 38 | | if (update.ManagedBot is not null) return "managed_bot"; |
| | | 39 | | |
| | 0 | 40 | | return "unknown"; |
| | | 41 | | } |
| | | 42 | | } |