telegram

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Animation

type Animation struct {
	FileID   string     `json:"file_id"`
	Thumb    *PhotoSize `json:"thumb"`
	FileName string     `json:"file_name"`
	MimeType string     `json:"mime_type"`
	FileSize int64      `json:"file_size"`
}

Animation type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#Animation

type Audio

type Audio struct {
	FileID    string `json:"file_id"`
	Duration  int64  `json:"duration"`
	Performer string `json:"performer"`
	Title     string `json:"title"`
	MimeType  string `json:"mime_type"`
	FileSize  int64  `json:"file_size"`
}

Audio type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#Audio

type CallbackGame

type CallbackGame struct {
	UserID             int64  `json:"user_id"`
	Score              int64  `json:"score"`
	Force              bool   `json:"force"`
	DisableEditMessage bool   `json:"disable_edit_message"`
	ChatID             int64  `json:"chat_id"`
	MessageID          int64  `json:"message_id"`
	InlineMessageID    string `json:"inline_message_id"`
}

CallbackGame type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#CallbackGame

type CallbackQuery

type CallbackQuery struct {
	ID              string   `json:"id"`
	From            *User    `json:"from"`
	Message         *Message `json:"message"`
	InlineMessageID string   `json:"inline_message_id"`
	ChatInstance    string   `json:"chat_instance"`
	Data            string   `json:"data"`
	GameShortName   string   `json:"game_short_name"`
}

CallbackQuery type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#CallbackQuery

type Chat

type Chat struct {
	ID                          int64      `json:"id"`
	Type                        string     `json:"type"`
	Title                       string     `json:"title"`
	Username                    string     `json:"username"`
	FirstName                   string     `json:"first_name"`
	LastName                    string     `json:"last_name"`
	AllMembersAreAdministrators bool       `json:"all_members_are_administrators"`
	Photo                       *ChatPhoto `json:"photo"`
	Description                 string     `json:"description"`
	InviteLink                  string     `json:"invite_link"`
}

Chat type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#Chat

type ChatMember

type ChatMember struct {
	User                  *User  `json:"user"`
	Status                string `json:"status"`
	UntilDate             int64  `json:"until_date"`
	CanBeEdited           bool   `json:"can_be_edited"`
	CanChangeInfo         bool   `json:"can_change_info"`
	CanPostMessages       bool   `json:"can_post_messages"`
	CanEditMessages       bool   `json:"can_edit_messages"`
	CanDeleteMessages     bool   `json:"can_delete_messages"`
	CanInviteUsers        bool   `json:"can_invite_users"`
	CanRestrictMembers    bool   `json:"can_restrict_members"`
	CanPinMessages        bool   `json:"can_pin_messages"`
	CanPromoteMembers     bool   `json:"can_promote_members"`
	CanSendMessages       bool   `json:"can_send_messages"`
	CanSendMediaMessages  bool   `json:"can_send_media_messages"`
	CanSendOtherMessages  bool   `json:"can_send_other_messages"`
	CanAddWebPagePreviews bool   `json:"can_add_web_page_previews"`
}

ChatMember type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#ChatMember

type ChatPhoto

type ChatPhoto struct {
	SmallFileID string `json:"small_file_id"`
	BigFileID   string `json:"big_file_id"`
}

ChatPhoto type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#ChatPhoto

type ChosenInlineResult

type ChosenInlineResult struct {
	ResultID        string    `json:"result_id"`
	From            *User     `json:"from"`
	Location        *Location `json:"location"`
	InlineMessageID string    `json:"inline_message_id"`
	Query           string    `json:"query"`
}

ChosenInlineResult type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#ChosenInlineResult

type Contact

type Contact struct {
	PhoneNumber string `json:"phone_number"`
	FirstName   string `json:"first_name"`
	LastName    string `json:"last_name"`
	UserID      int64  `json:"user_id"`
}

Contact type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#Contact

type Document

type Document struct {
	FileID   string     `json:"file_id"`
	Thumb    *PhotoSize `json:"thumb"`
	FileName string     `json:"file_name"`
	MimeType string     `json:"mime_type"`
	FileSize int64      `json:"file_size"`
}

Document type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#Document

type File

type File struct {
	FileID   string `json:"file_id"`
	FileSize int64  `json:"file_size"`
	FilePath string `json:"file_path"`
}

File type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#File

type ForceReply

type ForceReply struct {
	ForceReply bool `json:"force_reply"`
	Selective  bool `json:"selective"`
}

ForceReply type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#ForceReply

type Game

type Game struct {
	Title        string           `json:"title"`
	Description  string           `json:"description"`
	Photo        *[]PhotoSize     `json:"photo"`
	Text         string           `json:"text"`
	TextEntities *[]MessageEntity `json:"text_entities"`
	Animation    *Animation       `json:"animation"`
}

Game type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#Game

type Gateway

type Gateway interface {
	api.Peripheral
	api.Receptor
	// This method must call the getMe method from the Telegram Bot API. It must return the response formatted into a
	// User instance.
	GetMe() (User, error)
	// This method must call the sendMessage method from the Telegram Bot API. The method must return the response
	// formatted into a Message object.
	SendMessage(params Parameters) (Message, error)
	// This method must return a new Parameters instance which can be used as argument to the other methods of the
	// Gateway type.
	NewParameters() Parameters
}

The Gateway interface specifies the methods that must be implemented by a complete Telegram peripheral and receptor. The reference implementation at https://github.com/emersyx/emersyx_telegram follows this interface.

type InlineKeyboardButton

type InlineKeyboardButton struct {
	Text                         string        `json:"text"`
	URL                          string        `json:"url"`
	CallbackData                 string        `json:"callback_data"`
	SwitchInlineQuery            string        `json:"switch_inline_query"`
	SwitchInlineQueryCurrentChat string        `json:"switch_inline_query_current_chat"`
	CallbackGame                 *CallbackGame `json:"callback_game"`
	Pay                          bool          `json:"pay"`
}

InlineKeyboardButton type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#InlineKeyboardButton

type InlineKeyboardMarkup

type InlineKeyboardMarkup struct {
	InlineKeyboard *[][]InlineKeyboardButton `json:"inline_keyboard"`
}

InlineKeyboardMarkup type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#InlineKeyboardMarkup

type InlineQuery

type InlineQuery struct {
	ID       string    `json:"id"`
	From     *User     `json:"from"`
	Location *Location `json:"location"`
	Query    string    `json:"query"`
	Offset   string    `json:"offset"`
}

InlineQuery type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#InlineQuery

type Invoice

type Invoice struct {
	Title          string `json:"title"`
	Description    string `json:"description"`
	StartParameter string `json:"start_parameter"`
	Currency       string `json:"currency"`
	TotalAmount    int64  `json:"total_amount"`
}

Invoice type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#Invoice

type KeyboardButton

type KeyboardButton struct {
	Text            string `json:"text"`
	RequestContact  bool   `json:"request_contact"`
	RequestLocation bool   `json:"request_location"`
}

KeyboardButton type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#KeyboardButton

type Location

type Location struct {
	Longitude *float64 `json:"longitude"`
	Latitude  *float64 `json:"latitude"`
}

Location type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#Location

type MaskPosition

type MaskPosition struct {
	Point  string  `json:"point"`
	XShift float64 `json:"x_shift"`
	YShift float64 `json:"y_shift"`
	Scale  float64 `json:"scale"`
}

MaskPosition type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#MaskPosition

type Message

type Message struct {
	MessageID             int64              `json:"message_id"`
	From                  *User              `json:"from"`
	Date                  int64              `json:"date"`
	Chat                  *Chat              `json:"chat"`
	ForwardFrom           *User              `json:"forward_from"`
	ForwardFromChat       *Chat              `json:"forward_from_chat"`
	ForwardFromMessageID  int64              `json:"forward_from_message_id"`
	ForwardDate           int64              `json:"forward_date"`
	ReplyToMessage        *Message           `json:"reply_to_message"`
	EditDate              int64              `json:"edit_date"`
	Text                  string             `json:"text"`
	Entities              *[]MessageEntity   `json:"entities"`
	Audio                 *Audio             `json:"audio"`
	Document              *Document          `json:"document"`
	Game                  *Game              `json:"game"`
	Photo                 *[]PhotoSize       `json:"photo"`
	Sticker               *Sticker           `json:"sticker"`
	Video                 *Video             `json:"video"`
	Voice                 *Voice             `json:"voice"`
	VideoNote             *VideoNote         `json:"video_note"`
	NewChatMembers        *[]User            `json:"new_chat_members"`
	Caption               string             `json:"caption"`
	Contact               *Contact           `json:"contact"`
	Location              *Location          `json:"location"`
	Venue                 *Venue             `json:"venue"`
	NewChatMember         *User              `json:"new_chat_member"`
	LeftChatMember        *User              `json:"left_chat_member"`
	NewChatTitle          string             `json:"new_chat_title"`
	NewChatPhoto          *[]PhotoSize       `json:"new_chat_photo"`
	DeleteChatPhoto       bool               `json:"delete_chat_photo"`
	GroupChatCreated      bool               `json:"group_chat_created"`
	SupergroupChatCreated bool               `json:"supergroup_chat_created"`
	ChannelChatCreated    bool               `json:"channel_chat_created"`
	MigrateToChatID       int64              `json:"migrate_to_chat_id"`
	MigrateFromChatID     int64              `json:"migrate_from_chat_id"`
	PinnedMessage         *Message           `json:"pinned_message"`
	Invoice               *Invoice           `json:"invoice"`
	SuccessfulPayment     *SuccessfulPayment `json:"successful_payment"`
}

Message type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#message

type MessageEntity

type MessageEntity struct {
	Type   string `json:"type"`
	Offset int64  `json:"offset"`
	Length int64  `json:"length"`
	URL    string `json:"url"`
	User   *User  `json:"user"`
}

MessageEntity type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#MessageEntity

type OrderInfo

type OrderInfo struct {
	Name            string           `json:"name"`
	PhoneNumber     string           `json:"phone_number"`
	Email           string           `json:"email"`
	ShippingAddress *ShippingAddress `json:"shipping_address"`
}

OrderInfo type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#OrderInfo

type Parameters

type Parameters interface {
	// Offset must set the offset parameter.
	Offset(value int64) error
	// Limit must set the limit parameter.
	Limit(value uint) error
	// Timeout must set the timeout parameter.
	Timeout(value uint) error
	// AllowedUpdates must set the allowed_updates parameter.
	AllowedUpdates(values ...string) error
	// ChatID must set the chat_id parameter. In the official documentation this parameter is of type Integer or String.
	// If you wish to use an Integer as parameter, then simply pass a go string object with the contents of the Integer.
	ChatID(value string) error
	// Text must set the text parameter.
	Text(value string) error
	// ParseMode must set the parse_mode parameter.
	ParseMode(value string) error
	// DisableWebPagePreview must set the disable_web_page_preview parameter.
	DisableWebPagePreview(value bool) error
	// DisableNotification must set the disable_notification parameter.
	DisableNotification(value bool) error
	// ReplyToMessageID must set the reply_to_message_id parameter.
	ReplyToMessageID(value int64) error
	// ReplyMarkup must set the reply_markup parameter. In the official documentation, this parameter is of type
	// InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove or ForceReply. Based on the documentation, the
	// parameter is expected to be JSON-serialized. This method takes a string as argument which should be a JSON string
	// of the appropriate object.
	ReplyMarkup(value string) error
}

Parameters is the interface type which should be implemented to enable setting of parameter values when making calls to the Telegram Bot API.

type PhotoSize

type PhotoSize struct {
	FileID   string `json:"file_id"`
	Width    int64  `json:"width"`
	Height   int64  `json:"height"`
	FileSize int64  `json:"file_size"`
}

PhotoSize type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#PhotoSize

type PreCheckoutQuery

type PreCheckoutQuery struct {
	ID               string     `json:"id"`
	From             *User      `json:"from"`
	Currency         string     `json:"currency"`
	TotalAmount      int64      `json:"total_amount"`
	InvoicePayload   string     `json:"invoice_payload"`
	ShippingOptionID string     `json:"shipping_option_id"`
	OrderInfo        *OrderInfo `json:"order_info"`
}

PreCheckoutQuery type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#PreCheckoutQuery

type ReplyKeyboardMarkup

type ReplyKeyboardMarkup struct {
	Keyboard        *[][]KeyboardButton `json:"keyboard"`
	ResizeKeyboard  bool                `json:"resize_keyboard"`
	OneTimeKeyboard bool                `json:"one_time_keyboard"`
	Selective       bool                `json:"selective"`
}

ReplyKeyboardMarkup type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#ReplyKeyboardMarkup

type ReplyKeyboardRemove

type ReplyKeyboardRemove struct {
	RemoveKeyboard bool `json:"remove_keyboard"`
	Selective      bool `json:"selective"`
}

ReplyKeyboardRemove type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#ReplyKeyboardRemove

type ResponseParameters

type ResponseParameters struct {
	MigrateToChatID int64 `json:"migrate_to_chat_id"`
	RetryAfter      int64 `json:"retry_after"`
}

ResponseParameters type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#ResponseParameters

type ShippingAddress

type ShippingAddress struct {
	CountryCode string `json:"country_code"`
	State       string `json:"state"`
	City        string `json:"city"`
	StreetLine1 string `json:"street_line1"`
	StreetLine2 string `json:"street_line2"`
	PostCode    string `json:"post_code"`
}

ShippingAddress type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#ShippingAddress

type ShippingQuery

type ShippingQuery struct {
	ID              string           `json:"id"`
	From            *User            `json:"from"`
	InvoicePayload  string           `json:"invoice_payload"`
	ShippingAddress *ShippingAddress `json:"shipping_address"`
}

ShippingQuery type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#ShippingQuery

type Sticker

type Sticker struct {
	FileID       string        `json:"file_id"`
	Width        int64         `json:"width"`
	Height       int64         `json:"height"`
	Thumb        *PhotoSize    `json:"thumb"`
	Emoji        string        `json:"emoji"`
	SetName      string        `json:"set_name"`
	MaskPosition *MaskPosition `json:"mask_position"`
	FileSize     int64         `json:"file_size"`
}

Sticker type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#Sticker

type SuccessfulPayment

type SuccessfulPayment struct {
	Currency                string     `json:"currency"`
	TotalAmount             int64      `json:"total_amount"`
	InvoicePayload          string     `json:"invoice_payload"`
	ShippingOptionID        string     `json:"shipping_option_id"`
	OrderInfo               *OrderInfo `json:"order_info"`
	TelegramPaymentChargeID string     `json:"telegram_payment_charge_id"`
	ProviderPaymentChargeID string     `json:"provider_payment_charge_id"`
}

SuccessfulPayment type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#SuccessfulPayment

type Update

type Update struct {
	UpdateID           int64               `json:"update_id"`
	Message            *Message            `json:"message"`
	EditedMessage      *Message            `json:"edited_message"`
	ChannelPost        *Message            `json:"channel_post"`
	EditedChannelPost  *Message            `json:"edited_channel_post"`
	InlineQuery        *InlineQuery        `json:"inline_query"`
	ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result"`
	CallbackQuery      *CallbackQuery      `json:"callback_query"`
	ShippingQuery      *ShippingQuery      `json:"shipping_query"`
	PreCheckoutQuery   *PreCheckoutQuery   `json:"pre_checkout_query"`
	Source             string
}

Update type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#Update The Source member is mandatory for emersyx to identify the Gateway instance which generated this event. This is the only member that is not present in the Telegram Bot API.

func (Update) GetSourceIdentifier

func (u Update) GetSourceIdentifier() string

GetSourceIdentifier returns the identifier of the Gateway instance which generated the emersyx event.

type User

type User struct {
	ID           int64  `json:"id"`
	IsBot        bool   `json:"is_bot"`
	FirstName    string `json:"first_name"`
	LastName     string `json:"last_name"`
	Username     string `json:"username"`
	LanguageCode string `json:"language_code"`
}

User type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#User

type UserProfilePhotos

type UserProfilePhotos struct {
	TotalCount int64          `json:"total_count"`
	Photos     *[][]PhotoSize `json:"photos"`
}

UserProfilePhotos type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#UserProfilePhotos

type Venue

type Venue struct {
	Location     *Location `json:"location"`
	Title        string    `json:"title"`
	Address      string    `json:"address"`
	FoursquareID string    `json:"foursquare_id"`
}

Venue type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#Venue

type Video

type Video struct {
	FileID   string     `json:"file_id"`
	Width    int64      `json:"width"`
	Height   int64      `json:"height"`
	Duration int64      `json:"duration"`
	Thumb    *PhotoSize `json:"thumb"`
	MimeType string     `json:"mime_type"`
	FileSize int64      `json:"file_size"`
}

Video type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#Video

type VideoNote

type VideoNote struct {
	FileID   string     `json:"file_id"`
	Length   int64      `json:"length"`
	Duration int64      `json:"duration"`
	Thumb    *PhotoSize `json:"thumb"`
	FileSize int64      `json:"file_size"`
}

VideoNote type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#VideoNote

type Voice

type Voice struct {
	FileID   string `json:"file_id"`
	Duration int64  `json:"duration"`
	MimeType string `json:"mime_type"`
	FileSize int64  `json:"file_size"`
}

Voice type with fields compatible to the Telegram Bot API. https://core.telegram.org/bots/api#Voice

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳