chore: import clean Agent Desk snapshot (3/7)
This commit is contained in:
70
internal/telegram/types.go
Normal file
70
internal/telegram/types.go
Normal file
@@ -0,0 +1,70 @@
|
||||
package telegram
|
||||
|
||||
// Update represents an incoming update from Telegram Bot Webhook.
|
||||
type Update struct {
|
||||
UpdateID int64 `json:"update_id"`
|
||||
Message *Message `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
// Message represents a Telegram message.
|
||||
type Message struct {
|
||||
MessageID int64 `json:"message_id"`
|
||||
From *User `json:"from,omitempty"`
|
||||
Chat Chat `json:"chat"`
|
||||
Date int64 `json:"date"`
|
||||
Text string `json:"text,omitempty"`
|
||||
Caption string `json:"caption,omitempty"`
|
||||
}
|
||||
|
||||
// User represents a Telegram user or bot.
|
||||
type User struct {
|
||||
ID int64 `json:"id"`
|
||||
IsBot bool `json:"is_bot"`
|
||||
FirstName string `json:"first_name"`
|
||||
LastName string `json:"last_name,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
LanguageCode string `json:"language_code,omitempty"`
|
||||
}
|
||||
|
||||
// Chat represents a Telegram chat (private, group, supergroup, channel).
|
||||
type Chat struct {
|
||||
ID int64 `json:"id"`
|
||||
Type string `json:"type"`
|
||||
Title string `json:"title,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
FirstName string `json:"first_name,omitempty"`
|
||||
LastName string `json:"last_name,omitempty"`
|
||||
}
|
||||
|
||||
// SendMessageRequest represents payload for Telegram sendMessage API.
|
||||
type SendMessageRequest struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
Text string `json:"text"`
|
||||
ParseMode string `json:"parse_mode,omitempty"`
|
||||
ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`
|
||||
DisableWebPagePreview bool `json:"disable_web_page_preview,omitempty"`
|
||||
}
|
||||
|
||||
// APIResponse represents standard Telegram Bot API response envelope.
|
||||
type APIResponse[T any] struct {
|
||||
OK bool `json:"ok"`
|
||||
Result T `json:"result,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
ErrorCode int `json:"error_code,omitempty"`
|
||||
}
|
||||
|
||||
// SetWebhookRequest represents payload for Telegram setWebhook API.
|
||||
type SetWebhookRequest struct {
|
||||
URL string `json:"url"`
|
||||
SecretToken string `json:"secret_token,omitempty"`
|
||||
AllowedUpdates []string `json:"allowed_updates,omitempty"`
|
||||
}
|
||||
|
||||
// WebhookInfo represents current Telegram webhook status.
|
||||
type WebhookInfo struct {
|
||||
URL string `json:"url"`
|
||||
HasCustomCertificate bool `json:"has_custom_certificate"`
|
||||
PendingUpdateCount int `json:"pending_update_count"`
|
||||
LastErrorDate int64 `json:"last_error_date,omitempty"`
|
||||
LastErrorMessage string `json:"last_error_message,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user