Documentation
¶
Index ¶
- Constants
- func ButtonHandler(bot *Bot, recipient FBChat, payload string)
- func TextHandler(bot *Bot, recipient FBChat, text string)
- func WebhookListen(bot *Bot) fasthttp.RequestHandler
- func WebhookVerify(bot *Bot) fasthttp.RequestHandler
- type Album
- type Animation
- type Attachment
- type Audio
- type Bot
- func (b *Bot) ChatByID(id string) (*Chat, error)
- func (b *Bot) GetFile(file *File) (io.ReadCloser, error)
- func (b *Bot) Handle(endpoint, handler interface{})
- func (b *Bot) Send(chat *Chat, what interface{}, options ...interface{}) (*Message, error)
- func (b *Bot) SendAlbum(chat *Chat, album Album, options ...interface{}) ([]Message, error)
- func (b *Bot) Start()
- type Btn
- type Button
- type Chat
- type Contact
- type Document
- type Element
- type Entry
- type FBChat
- type File
- type InlineButton
- type InputMedia
- type Location
- type Message
- type Messaging
- type ParseMode
- type Payload
- type Photo
- type Postback
- type ProximityAlertTriggered
- type QuickReplies
- type Read
- type ReplyButton
- type ReplyMarkup
- type Row
- type SendMessage
- type SendOptions
- type Settings
- type TextMessage
- type TextResponse
- type Tick
- type User
- type Venue
- type Video
- type VideoNote
- type Voice
- type Webhook
Constants ¶
const ( OnText = "\atext" OnContact = "\acontact" OnVoice = "\avoice" OnAudio = "\aaudio" )
Variables ¶
This section is empty.
Functions ¶
func ButtonHandler ¶ added in v0.1.0
func TextHandler ¶
func WebhookListen ¶
func WebhookListen(bot *Bot) fasthttp.RequestHandler
func WebhookVerify ¶
func WebhookVerify(bot *Bot) fasthttp.RequestHandler
Types ¶
type Album ¶ added in v0.0.5
type Album []InputMedia
Album lets you group multiple media (so-called InputMedia) into a single message.
On older clients albums look like N regular messages.
type Animation ¶ added in v0.0.5
type Animation struct { File Width int `json:"width"` Height int `json:"height"` Duration int `json:"duration,omitempty"` // (Optional) Caption string `json:"caption,omitempty"` Thumbnail *Photo `json:"thumb,omitempty"` MIME string `json:"mime_type,omitempty"` FileName string `json:"file_name,omitempty"` }
Animation object represents a animation file.
type Attachment ¶
type Audio ¶ added in v0.0.5
type Audio struct { File // Duration of the recording in seconds as defined by sender. Duration int `json:"duration,omitempty"` // (Optional) Caption string `json:"caption,omitempty"` Thumbnail *Photo `json:"thumb,omitempty"` Title string `json:"title,omitempty"` Performer string `json:"performer,omitempty"` MIME string `json:"mime_type,omitempty"` FileName string `json:"file_name,omitempty"` }
Audio object represents an audio file.
type Bot ¶
type Bot struct { PageAccessToken string VerifyToken string PageID string // contains filtered or unexported fields }
type Btn ¶ added in v0.0.5
func (*Btn) CallbackUnique ¶ added in v0.0.5
func (Btn) Inline ¶ added in v0.0.6
func (b Btn) Inline() *InlineButton
func (Btn) Reply ¶ added in v0.0.5
func (b Btn) Reply() *ReplyButton
type Contact ¶ added in v0.0.5
type Contact struct { PhoneNumber string `json:"phone_number"` FirstName string `json:"first_name"` // (Optional) LastName string `json:"last_name"` UserID int `json:"user_id,omitempty"` }
Contact object represents a contact to Telegram user
type Document ¶ added in v0.0.5
type Document struct { File // (Optional) Thumbnail *Photo `json:"thumb,omitempty"` Caption string `json:"caption,omitempty"` MIME string `json:"mime_type"` FileName string `json:"file_name,omitempty"` }
Document object represents a general file (as opposed to Photo or Audio). Telegram users can send files of any type of up to 1.5 GB in size.
type File ¶ added in v0.0.5
type File struct { FileID string `json:"file_id"` UniqueID string `json:"file_unique_id"` FileSize int `json:"file_size"` // file on telegram server https://core.telegram.org/bots/api#file FilePath string `json:"file_path"` // file on local file system. FileLocal string `json:"file_local"` // file on the internet FileURL string `json:"file_url"` // file backed with io.Reader FileReader io.Reader `json:"-"` // contains filtered or unexported fields }
File object represents any sort of file.
func FromReader ¶ added in v0.0.6
type InlineButton ¶ added in v0.0.6
type InlineButton struct { // Unique slagish name for this kind of button, // try to be as specific as possible. // // It will be used as a callback endpoint. Unique string `json:"unique,omitempty"` Text string `json:"text"` URL string `json:"url,omitempty"` Data string `json:"callback_data,omitempty"` }
InlineButton represents a button displayed in the message.
type InputMedia ¶ added in v0.0.5
type InputMedia interface { // MediaFile As some files must be uploaded (instead of referencing) // outer layers of Telebot require it. MediaFile() *File }
InputMedia is a generic type for all kinds of media you can put into an album.
type Location ¶ added in v0.0.5
type Location struct { // Latitude Lat float32 `json:"latitude"` // Longitude Lng float32 `json:"longitude"` // Horizontal Accuracy HorizontalAccuracy *float32 `json:"horizontal_accuracy,omitempty"` // Period in seconds for which the location will be updated // (see Live Locations, should be between 60 and 86400.) LivePeriod int `json:"live_period,omitempty"` Heading int `json:"heading,omitempty"` ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"` }
Location object represents geographic position.
type Photo ¶ added in v0.0.5
type Photo struct { File Width int `json:"width"` Height int `json:"height"` Caption string `json:"caption,omitempty"` }
Photo object represents a single photo file.
func (*Photo) UnmarshalJSON ¶ added in v0.0.5
UnmarshalJSON is custom unmarshaller required to abstract away the hassle of treating different thumbnail sizes. Instead, Telebot chooses the hi-res one and just sticks to it.
I really do find it a beautiful solution.
type ProximityAlertTriggered ¶ added in v0.0.5
type ProximityAlertTriggered struct { Traveler *User `json:"traveler,omitempty"` Watcher *User `json:"watcher,omitempty"` Distance int `json:"distance"` }
ProximityAlertTriggered sent whenever a user in the chat triggers a proximity alert set by another user.
type QuickReplies ¶
type ReplyButton ¶ added in v0.0.3
type ReplyMarkup ¶ added in v0.0.3
type ReplyMarkup struct { ReplyKeyboard [][]ReplyButton `json:"keyboard,omitempty"` ResizeReplyKeyboard bool `json:"resize_reply_keyboard"` ReplyKeyboardRemove bool `json:"reply_keyboard_remove"` InlineKeyboard [][]InlineButton `json:"inline_keyboard,omitempty"` }
func (*ReplyMarkup) Contact ¶ added in v0.0.5
func (r *ReplyMarkup) Contact(text string) Btn
func (*ReplyMarkup) Data ¶ added in v0.0.6
func (r *ReplyMarkup) Data(text, unique string, data ...string) Btn
func (*ReplyMarkup) Inline ¶ added in v0.0.6
func (r *ReplyMarkup) Inline(rows ...Row)
func (*ReplyMarkup) Reply ¶ added in v0.0.5
func (r *ReplyMarkup) Reply(rows ...Row)
func (*ReplyMarkup) Row ¶ added in v0.0.5
func (r *ReplyMarkup) Row(many ...Btn) Row
func (*ReplyMarkup) Text ¶ added in v0.0.5
func (r *ReplyMarkup) Text(text string) Btn
type SendMessage ¶ added in v0.0.3
type SendOptions ¶ added in v0.0.3
type SendOptions struct { ReplyMarkup *ReplyMarkup ParseMode interface{} DisableNotification interface{} }
type TextMessage ¶
type TextMessage struct { Text *string `json:"text,omitempty"` Attachment *Attachment `json:"attachment,omitempty"` QuickReplies *QuickReplies `json:"quick_replies,omitempty"` }
type TextResponse ¶
type TextResponse struct { Recipient FBChat `json:"recipient,omitempty"` MessagingType *string `json:"messaging_type,omitempty"` Message TextMessage `json:"message,omitempty"` }
type User ¶ added in v0.0.5
type User struct { ID int `json:"id"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Username string `json:"username"` LanguageCode string `json:"language_code"` IsBot bool `json:"is_bot"` // Returns only in getMe CanJoinGroups bool `json:"can_join_groups"` CanReadMessages bool `json:"can_read_all_group_messages"` SupportsInline bool `json:"supports_inline_queries"` }
User object represents a Telegram user, bot.
type Venue ¶ added in v0.0.5
type Venue struct { Location Location `json:"location"` Title string `json:"title"` Address string `json:"address"` // (Optional) FoursquareID string `json:"foursquare_id,omitempty"` FoursquareType string `json:"foursquare_type,omitempty"` GooglePlaceID string `json:"google_place_id,omitempty"` GooglePlaceType string `json:"google_place_type,omitempty"` }
Venue object represents a venue location with name, address and optional foursquare ID.
type Video ¶ added in v0.0.5
type Video struct { File Width int `json:"width"` Height int `json:"height"` Duration int `json:"duration,omitempty"` // (Optional) Caption string `json:"caption,omitempty"` Thumbnail *Photo `json:"thumb,omitempty"` SupportsStreaming bool `json:"supports_streaming,omitempty"` MIME string `json:"mime_type,omitempty"` FileName string `json:"file_name,omitempty"` }
Video object represents a video file.
type VideoNote ¶ added in v0.0.5
type VideoNote struct { File // Duration of the recording in seconds as defined by sender. Duration int `json:"duration"` // (Optional) Thumbnail *Photo `json:"thumb,omitempty"` Length int `json:"length,omitempty"` }
VideoNote represents a video message (available in Telegram apps as of v.4.0).