diff --git a/methods.go b/methods.go index 7f822a2..9e01a12 100644 --- a/methods.go +++ b/methods.go @@ -14,120 +14,6 @@ import ( "strconv" ) -// Constant values for ChatActions -const ( - ChatTyping = "typing" - ChatUploadPhoto = "upload_photo" - ChatRecordVideo = "record_video" - ChatUploadVideo = "upload_video" - ChatRecordAudio = "record_audio" - ChatUploadAudio = "upload_audio" - ChatUploadDocument = "upload_document" - ChatFindLocation = "find_location" -) - -// MessageConfig contains information about a SendMessage request. -type MessageConfig struct { - ChatID int - Text string - DisableWebPagePreview bool - ReplyToMessageID int - ReplyMarkup interface{} -} - -// ForwardConfig contains infomation about a ForwardMessage request. -type ForwardConfig struct { - ChatID int - FromChatID int - MessageID int -} - -// PhotoConfig contains information about a SendPhoto request. -type PhotoConfig struct { - ChatID int - Caption string - ReplyToMessageID int - ReplyMarkup interface{} - UseExistingPhoto bool - FilePath string - FileID string -} - -// AudioConfig contains information about a SendAudio request. -type AudioConfig struct { - ChatID int - ReplyToMessageID int - ReplyMarkup interface{} - UseExistingAudio bool - FilePath string - FileID string -} - -// DocumentConfig contains information about a SendDocument request. -type DocumentConfig struct { - ChatID int - ReplyToMessageID int - ReplyMarkup interface{} - UseExistingDocument bool - FilePath string - FileID string -} - -// StickerConfig contains information about a SendSticker request. -type StickerConfig struct { - ChatID int - ReplyToMessageID int - ReplyMarkup interface{} - UseExistingSticker bool - FilePath string - FileID string -} - -// VideoConfig contains information about a SendVideo request. -type VideoConfig struct { - ChatID int - ReplyToMessageID int - ReplyMarkup interface{} - UseExistingVideo bool - FilePath string - FileID string -} - -// LocationConfig contains information about a SendLocation request. -type LocationConfig struct { - ChatID int - Latitude float64 - Longitude float64 - ReplyToMessageID int - ReplyMarkup interface{} -} - -// ChatActionConfig contains information about a SendChatAction request. -type ChatActionConfig struct { - ChatID int - Action string -} - -// UserProfilePhotosConfig contains information about a GetUserProfilePhotos request. -type UserProfilePhotosConfig struct { - UserID int - Offset int - Limit int -} - -// UpdateConfig contains information about a GetUpdates request. -type UpdateConfig struct { - Offset int - Limit int - Timeout int -} - -// WebhookConfig contains information about a SetWebhook request. -type WebhookConfig struct { - Clear bool - URL *url.URL -} - // MakeRequest makes a request to a specific endpoint with our token. // All requests are POSTs because Telegram doesn't care, and it's easier. func (bot *BotAPI) MakeRequest(endpoint string, params url.Values) (APIResponse, error) { diff --git a/types.go b/types.go index 0fe4fde..d31b78f 100644 --- a/types.go +++ b/types.go @@ -4,6 +4,18 @@ import ( "encoding/json" ) +// Constant values for ChatActions +const ( + ChatTyping = "typing" + ChatUploadPhoto = "upload_photo" + ChatRecordVideo = "record_video" + ChatUploadVideo = "upload_video" + ChatRecordAudio = "record_audio" + ChatUploadAudio = "upload_audio" + ChatUploadDocument = "upload_document" + ChatFindLocation = "find_location" +) + // APIResponse is a response from the Telegram API with the result stored raw. type APIResponse struct { Ok bool `json:"ok"` @@ -151,3 +163,105 @@ type ForceReply struct { ForceReply bool `json:"force_reply"` Selective bool `json:"force_reply"` } + +// MessageConfig contains information about a SendMessage request. +type MessageConfig struct { + ChatID int + Text string + DisableWebPagePreview bool + ReplyToMessageID int + ReplyMarkup interface{} +} + +// ForwardConfig contains infomation about a ForwardMessage request. +type ForwardConfig struct { + ChatID int + FromChatID int + MessageID int +} + +// PhotoConfig contains information about a SendPhoto request. +type PhotoConfig struct { + ChatID int + Caption string + ReplyToMessageID int + ReplyMarkup interface{} + UseExistingPhoto bool + FilePath string + FileID string +} + +// AudioConfig contains information about a SendAudio request. +type AudioConfig struct { + ChatID int + ReplyToMessageID int + ReplyMarkup interface{} + UseExistingAudio bool + FilePath string + FileID string +} + +// DocumentConfig contains information about a SendDocument request. +type DocumentConfig struct { + ChatID int + ReplyToMessageID int + ReplyMarkup interface{} + UseExistingDocument bool + FilePath string + FileID string +} + +// StickerConfig contains information about a SendSticker request. +type StickerConfig struct { + ChatID int + ReplyToMessageID int + ReplyMarkup interface{} + UseExistingSticker bool + FilePath string + FileID string +} + +// VideoConfig contains information about a SendVideo request. +type VideoConfig struct { + ChatID int + ReplyToMessageID int + ReplyMarkup interface{} + UseExistingVideo bool + FilePath string + FileID string +} + +// LocationConfig contains information about a SendLocation request. +type LocationConfig struct { + ChatID int + Latitude float64 + Longitude float64 + ReplyToMessageID int + ReplyMarkup interface{} +} + +// ChatActionConfig contains information about a SendChatAction request. +type ChatActionConfig struct { + ChatID int + Action string +} + +// UserProfilePhotosConfig contains information about a GetUserProfilePhotos request. +type UserProfilePhotosConfig struct { + UserID int + Offset int + Limit int +} + +// UpdateConfig contains information about a GetUpdates request. +type UpdateConfig struct { + Offset int + Limit int + Timeout int +} + +// WebhookConfig contains information about a SetWebhook request. +type WebhookConfig struct { + Clear bool + URL *url.URL +}