Documentation ¶
Index ¶
- Constants
- type Audio
- type CommonChat
- type Contact
- type Document
- type GroupChat
- type Location
- type Message
- type PhotoSize
- type ReplyKeyboardMarkup
- type Response
- type Sticker
- type Telegram
- func (telegram Telegram) GetMe() (*User, error)
- func (telegram Telegram) SendMessage(chatID int, text string, disableWebPagePreview bool, replyToMessageID int, ...) (*Message, error)
- func (telegram Telegram) SendPhoto(chatID int, photo image.Image, caption string, replyToMessageID int, ...) (*Message, error)
- type Update
- type User
- type UserProfilePhotos
- type Video
Constants ¶
const BotURL string = "https://api.telegram.org/bot"
BotURL is url to telegram bot api
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Audio ¶
type Audio struct { FileID string `json:"file_id"` Duration int `json:"duration"` MimeType string `json:"mime_type,omitempty"` FileSize int `json:"file_size,omitempty"` }
Audio struct represents an audio file (voice note).
type CommonChat ¶
type CommonChat struct {
ID int `json:"id"`
}
CommonChat struct is base struct for Chat or User object
type Contact ¶
type Contact struct { PhoneNumber string `json:"phone_number"` FirstName string `json:"first_name"` LastName string `json:"last_name,omitempty"` UserID string `json:"user_id,omitempty"` }
Contact struct represents a phone contact.
type Document ¶
type Document struct { FileID string `json:"file_id"` Thumb PhotoSize `json:"thumb"` FileName string `json:"file_name,omitempty"` MimeType string `json:"mime_type,omitempty"` FileSize int `json:"file_size,omitempty"` }
Document struct represents a general file (as opposed to photos and audio files).
type Message ¶
type Message struct { MessageID int `json:"message_id"` From User `json:"from"` Date int `json:"date"` Chat CommonChat `json:"chat"` ForwardFrom User `json:"forward_from,omitempty"` ForwardDate int `json:"forward_date,omitempty"` ReplyToMessage *Message `json:"reply_to_message,omitempty"` Text string `json:"text,omitempty"` Audio Audio `json:"audio,omitempty"` Document Document `json:"document,omitempty"` Photo []PhotoSize `json:"photo,omitempty"` Sticker Sticker `json:"sticker,omitempty"` Video Video `json:"video,omitempty"` Contact Contact `json:"contact,omitempty"` Location Location `json:"location,omitempty"` NewChatParticipant User `json:"new_chat_participant,omitempty"` LeftChatParticipant User `json:"left_chat_participant,omitempty"` NewChatTitle string `json:"new_chat_title,omitempty"` NewChatPhoto []PhotoSize `json:"new_chat_photo,omitempty"` DeleteChatPhoto bool `json:"delete_chat_photo,omitempty"` GroupChatCreated bool `json:"group_chat_created,omitempty"` }
Message struct represents a message.
type PhotoSize ¶
type PhotoSize struct { FileID string `json:"file_id"` Width int `json:"width"` Height int `json:"height"` FileSize int `json:"file_size,omitempty"` }
PhotoSize struct represents one size of a photo or a file / sticker thumbnail.
type ReplyKeyboardMarkup ¶
type ReplyKeyboardMarkup struct { Keyboard [][]string `json:"keyboard"` ResizeKeyboard bool `json:"resize_keyboard,omitempty"` OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"` Selective bool `json:"selective,omitempty"` }
ReplyKeyboardMarkup struct represents a custom keyboard with reply options.
type Response ¶
type Response struct { Response *http.Response Ok bool `json:"ok"` Result interface{} `json:"result"` }
Response is telegram base response envelop
type Sticker ¶
type Sticker struct { FileID string `json:"file_id"` Width int `json:"width"` Height int `json:"heiht"` Thumb PhotoSize `json:"thumb"` FileSize int `json:"file_size,omitempty"` }
Sticker struct
type Telegram ¶
type Telegram struct { Key string // contains filtered or unexported fields }
Telegram is struct to store client data
func NewTelegram ¶
NewTelegram is factory method for Telegram struct
func (Telegram) GetMe ¶
GetMe A simple method for testing your bot's auth token. Requires no parameters. Returns basic information about the bot in form of a User object.
func (Telegram) SendMessage ¶
func (telegram Telegram) SendMessage(chatID int, text string, disableWebPagePreview bool, replyToMessageID int, replyMarkup *ReplyKeyboardMarkup) (*Message, error)
SendMessage - Use this method to send text messages
type User ¶
type User struct { ID int `json:"id"` FirstName string `json:"first_name"` LastName string `json:"last_name,omitempty"` Username string `json:"username,omitempty"` }
User struct represents a Telegram user or bot.
type UserProfilePhotos ¶
type UserProfilePhotos struct { TotalCount int `json:"total_count"` Photos []PhotoSize `json:"photos"` }
UserProfilePhotos struct represents a user's profile pictures.
type Video ¶
type Video struct { FileID string `json:"file_id"` Width int `json:"width"` Height int `json:"height"` Duration int `json:"duration"` Thumb PhotoSize `json:"thumb"` MimeType string `json:"mime_type,omitempty"` FileSize int `json:"fil_size,omitempty"` Caption string `json:"caption,omitempty"` }
Video struct represents a video file.