messagetype

package
v0.0.0-...-889dc0d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2026 License: MIT Imports: 1 Imported by: 0

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"
	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"
	GeneralForumTopicUnhidden MessageType = "general_forum_topic_unhidden"
)

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"
	UsersShared             MessageType = "users_shared"
	ChatShared              MessageType = "chat_shared"
	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"
	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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL