Documentation
¶
Overview ¶
Package messagetype provides constants and utilities for identifying the type of a Telegram message. It allows for easy routing and handling of different message contents and service events.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MessageType ¶
type MessageType string
MessageType represents the classification of a Telegram message.
const ( Text MessageType = "text" Animation MessageType = "animation" Audio MessageType = "audio" Document MessageType = "document" Photo MessageType = "photo" Sticker MessageType = "sticker" Story MessageType = "story" LivePhoto MessageType = "live_photo" Video MessageType = "video" VideoNote MessageType = "video_note" Voice MessageType = "voice" Contact MessageType = "contact" Dice MessageType = "dice" Game MessageType = "game" Poll MessageType = "poll" Venue MessageType = "venue" Location MessageType = "location" Invoice MessageType = "invoice" Checklist MessageType = "checklist" PaidMedia MessageType = "paid_media" Giveaway MessageType = "giveaway" )
Standard Content Types.
const ( NewChatMembers MessageType = "new_chat_members" LeftChatMember MessageType = "left_chat_member" NewChatTitle MessageType = "new_chat_title" NewChatPhoto MessageType = "new_chat_photo" DeleteChatPhoto MessageType = "delete_chat_photo" GroupChatCreated MessageType = "group_chat_created" SupergroupChatCreated MessageType = "supergroup_chat_created" ChannelChatCreated MessageType = "channel_chat_created" MessageAutoDeleteTimerChanged MessageType = "message_auto_delete_timer_changed" MigrateFromChatID MessageType = "migrate_from_chat_id" MigrateToChatID MessageType = "migrate_to_chat_id" )
Chat Lifecycle & Management.
const ( ForumTopicCreated MessageType = "forum_topic_created" ForumTopicEdited MessageType = "forum_topic_edited" ForumTopicClosed MessageType = "forum_topic_closed" ForumTopicReopened MessageType = "forum_topic_reopened" GeneralForumTopicHidden MessageType = "general_forum_topic_hidden" )
Topic Management.
const ( VideoChatScheduled MessageType = "video_chat_scheduled" VideoChatStarted MessageType = "video_chat_started" VideoChatEnded MessageType = "video_chat_ended" VideoChatParticipantsInvited MessageType = "video_chat_participants_invited" )
Video Chat Events.
const ( SuccessfulPayment MessageType = "successful_payment" RefundedPayment MessageType = "refunded_payment" )
Payments & Financial.
const ( GiveawayCompleted MessageType = "giveaway_completed" GiveawayCreated MessageType = "giveaway_created" GiveawayWinners MessageType = "giveaway_winners" Gift MessageType = "gift" GiftUpgradeSent MessageType = "gift_upgrade_sent" UniqueGift MessageType = "unique_gift" BoostAdded MessageType = "boost_added" )
Giveaways & Gifts.
const ( DirectMessagePriceChanged MessageType = "direct_message_price_changed" PaidMessagePriceChanged MessageType = "paid_message_price_changed" SuggestedPostApprovalFailed MessageType = "suggested_post_approval_failed" SuggestedPostApproved MessageType = "suggested_post_approved" SuggestedPostDeclined MessageType = "suggested_post_declined" SuggestedPostPaid MessageType = "suggested_post_paid" SuggestedPostRefunded MessageType = "suggested_post_refunded" )
Suggested Posts & Ads.
const ( PinnedMessage MessageType = "pinned_message" WriteAccessAllowed MessageType = "write_access_allowed" ProximityAlertTriggered MessageType = "proximity_alert_triggered" WebAppData MessageType = "web_app_data" ChatBackgroundSet MessageType = "chat_background_set" ChecklistTasksAdded MessageType = "checklist_tasks_added" ChecklistTasksDone MessageType = "checklist_tasks_done" ChatOwnerChanged MessageType = "chat_owner_changed" ChatOwnerLeft MessageType = "chat_owner_left" ManagedBotCreated MessageType = "managed_bot_created" PollOptionAdded MessageType = "poll_option_added" PollOptionDeleted MessageType = "poll_option_deleted" PassportData MessageType = "passport_data" ConnectedWebsite MessageType = "connected_website" )
Miscellaneous Service Events.
const ( // Unknown is returned when the message type cannot be identified. Unknown MessageType = "unknown" )
Special Types.
func Detect ¶
func Detect(message *client.Message) MessageType
Detect inspects a Telegram message and returns its most specific type. It prioritizes service messages (e.g., chat member changes) over standard content (e.g., text).