Documentation
¶
Index ¶
- Constants
- Variables
- func CheckToken(token string) bool
- type Animation
- type Audio
- type CallbackGame
- type CallbackQuery
- type Chat
- type ChatInviteLink
- type ChatLocation
- type ChatMember
- type ChatMemberUpdated
- type ChatPermissions
- type ChatPhoto
- type ChosenInlineResult
- type Command
- type Contact
- type Dice
- type Document
- type EncryptedCredentials
- type EncryptedPassportElement
- type Game
- type InlineKeyboardButton
- type InlineKeyboardMarkup
- type InlineQuery
- type Invoice
- type KeyboardButton
- type KeyboardButtonPollType
- type Location
- type LoginUrl
- type MaskPosition
- type Message
- type MessageAutoDeleteTimerChanged
- type MessageEntity
- type Options
- type OrderInfo
- type PassportData
- type PassportFile
- type PhotoSize
- type Poll
- type PollAnswer
- type PollOption
- type PreCheckoutQuery
- type ProximityAlertTriggered
- type ReplyKeyboardMarkup
- type ReplyMarkup
- type Settings
- type ShippingAddress
- type ShippingQuery
- type Sticker
- type SuccessfulPayment
- type Telepher
- func (telepher Telepher) GetMe() (*User, error)
- func (telepher Telepher) GetUpdates(offset int, limit int) ([]Update, error)
- func (telepher Telepher) Poll(ch chan Update)
- func (telepher Telepher) SendMessage(chat_id string, text string, option *Options) (*Message, error)
- func (telepher Telepher) SendPhoto(chat_id string, path string)
- func (telepher Telepher) Start()
- type Update
- type User
- type Venue
- type Video
- type VideoNote
- type Voice
- type VoiceChatEnded
- type VoiceChatParticipantsInvited
- type VoiceChatScheduled
- type VoiceChatStarted
Constants ¶
View Source
const ( DefaultBaseURL = "https://api.telegram.org/bot" DefaultBaseFileURL = "https://api.telegram.org/file/bot" DefaultParseMode = "None" )
Variables ¶
View Source
var DefaultClient = &http.Client{ Timeout: time.Second * 10, }
Functions ¶
func CheckToken ¶
Types ¶
type Animation ¶
type Animation struct {
FileId string `json:"file_id,omitempty"`
FileUniqueId string `json:"file_unique_id,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
Duration int `json:"duration,omitempty"`
Thumb *PhotoSize `json:"thumb,omitempty"`
FileName string `json:"file_name,omitempty"`
MimeType string `json:"mime_type,omitempty"`
FileSize int64 `json:"file_size,omitempty"`
}
type Audio ¶
type Audio struct {
FileId string `json:"file_id,omitempty"`
FileUniqueId string `json:"file_unique_id,omitempty"`
Duration int `json:"duration,omitempty"`
Performer string `json:"performer,omitempty"`
Title string `json:"title,omitempty"`
FileName string `json:"file_name,omitempty"`
MimeType string `json:"mime_type,omitempty"`
FileSize int `json:"file_size,omitempty"`
Thumb *PhotoSize `json:"thumb,omitempty"`
}
type CallbackGame ¶
type CallbackGame interface{}
type CallbackQuery ¶
type CallbackQuery struct {
Id string `json:"id,omitempty"`
From User `json:"from,omitempty"`
Message *Message `json:"message,omitempty"`
InlineMessageId string `json:"inline_message_id,omitempty"`
ChatInstance string `json:"chat_instance,omitempty"`
Data string `json:"data,omitempty"`
GameShortName string `json:"game_short_name,omitempty"`
}
type Chat ¶
type Chat struct {
Id int64 `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Title string `json:"title,omitempty"`
Username string `json:"username,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Photo *ChatPhoto `json:"photo,omitempty"`
Bio string `json:"bio,omitempty"`
Description string `json:"description,omitempty"`
InviteLink string `json:"invite_link,omitempty"`
PinnedMessage *Message `json:"pinned_message,omitempty"`
Permissions *ChatPermissions `json:"permissions,omitempty"`
SlowModeDelay int `json:"slow_mode_delay,omitempty"`
MessageAutoDeleteTime int `json:"message_auto_delete_time,omitempty"`
StickerSetName string `json:"sticker_set_name,omitempty"`
CanSetStickerSet bool `json:"can_set_sticker_set,omitempty"`
LinkedChatId int `json:"linked_chat_id,omitempty"`
Location *ChatLocation `json:"location,omitempty"`
}
type ChatInviteLink ¶
type ChatInviteLink struct {
InviteLink string `json:"invite_link,omitempty"`
Creator User `json:"creator,omitempty"`
IsPrimary bool `json:"is_primary,omitempty"`
IsRevoked bool `json:"is_revoked,omitempty"`
ExpireDate int `json:"expire_date,omitempty"`
MemberLimit int `json:"member_limit,omitempty"`
}
type ChatLocation ¶
type ChatMember ¶
type ChatMember struct {
User User `json:"user,omitempty"`
Status string `json:"status,omitempty"`
CustomTitle string `json:"custom_title,omitempty"`
IsAnonymous bool `json:"is_anonymous,omitempty"`
CanBeEdited bool `json:"can_be_edited,omitempty"`
CanManageChat bool `json:"can_manage_chat,omitempty"`
CanPostMessages bool `json:"can_post_messages,omitempty"`
CanEditMessages bool `json:"can_edit_messages,omitempty"`
CanDeleteMessages bool `json:"can_delete_messages,omitempty"`
CanManageVoiceChats bool `json:"can_manage_voice_chats,omitempty"`
CanRestrictMembers bool `json:"can_restrict_members,omitempty"`
CanPromoteMembers bool `json:"can_promote_members,omitempty"`
CanChangeInfo bool `json:"can_change_info,omitempty"`
CanInviteUsers bool `json:"can_invite_users,omitempty"`
CanPinMessages bool `json:"can_pin_messages,omitempty"`
IsMember bool `json:"is_member,omitempty"`
CanSendMessages bool `json:"can_send_messages,omitempty"`
CanSendMediaMessages bool `json:"can_send_media_messages,omitempty"`
CanSendPolls bool `json:"can_send_polls,omitempty"`
CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"`
CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"`
UntilDate int `json:"until_date,omitempty"`
}
type ChatMemberUpdated ¶
type ChatMemberUpdated struct {
Chat Chat `json:"chat,omitempty"`
From User `json:"from,omitempty"`
Date int `json:"date,omitempty"`
OldChatMember ChatMember `json:"old_chat_member,omitempty"`
NewChatMember ChatMember `json:"new_chat_member,omitempty"`
InviteLink *ChatInviteLink `json:"invite_link,omitempty"`
}
type ChatPermissions ¶
type ChatPermissions struct {
CanSendMessages bool `json:"can_send_messages,omitempty"`
CanSendMediaMessages bool `json:"can_send_media_messages,omitempty"`
CanSendPolls bool `json:"can_send_polls,omitempty"`
CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"`
CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"`
CanChangeInfo bool `json:"can_change_info,omitempty"`
CanInviteUsers bool `json:"can_invite_users,omitempty"`
CanPinMessages bool `json:"can_pin_messages,omitempty"`
}
type ChosenInlineResult ¶
type EncryptedCredentials ¶
type EncryptedPassportElement ¶
type EncryptedPassportElement struct {
Type string `json:"type,omitempty"`
Data string `json:"data,omitempty"`
PhoneNumber string `json:"phone_number,omitempty"`
Email string `json:"email,omitempty"`
Files []PassportFile `json:"files,omitempty"`
FrontSide *PassportFile `json:"front_side,omitempty"`
ReverseSide *PassportFile `json:"reverse_side,omitempty"`
Selfie *PassportFile `json:"selfie,omitempty"`
Translation []PassportFile `json:"translation,omitempty"`
Hash string `json:"hash,omitempty"`
}
type Game ¶
type Game struct {
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Photo []PhotoSize `json:"photo,omitempty"`
Text string `json:"text,omitempty"`
TextEntities []MessageEntity `json:"text_entities,omitempty"`
// contains filtered or unexported fields
}
type InlineKeyboardButton ¶
type InlineKeyboardButton struct {
Text string `json:"text,omitempty"`
Url string `json:"url,omitempty"`
LoginUrl *LoginUrl `json:"login_url,omitempty"`
CallbackData string `json:"callback_data,omitempty"`
SwitchInlineQuery string `json:"switch_inline_query,omitempty"`
SwitchInlineQueryCurrentChat string `json:"switch_inline_query_current_chat,omitempty"`
CallbackGame *CallbackGame `json:"callback_game,omitempty"`
Pay bool `json:"pay,omitempty"`
}
type InlineKeyboardMarkup ¶
type InlineKeyboardMarkup struct {
InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard,omitempty"`
}
type InlineQuery ¶
type KeyboardButton ¶
type KeyboardButton struct {
Text string `json:"text,omitempty"`
RequestContact bool `json:"request_contact,omitempty"`
RequestLocation bool `json:"request_location,omitempty"`
RequestPoll *KeyboardButtonPollType `json:"request_poll,omitempty"`
}
type KeyboardButtonPollType ¶
type KeyboardButtonPollType struct {
Type string `json:"type,omitempty"`
}
type Location ¶
type Location struct {
Longitude float64 `json:"longitude,omitempty"`
Latitude float64 `json:"latitude,omitempty"`
HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`
LivePeriod int `json:"live_period,omitempty"`
Heading int `json:"heading,omitempty"`
ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"`
}
type MaskPosition ¶
type Message ¶
type Message struct {
MessageId int `json:"message_id,omitempty"`
From *User `json:"from,omitempty"`
SenderChat *Chat `json:"sender_chat,omitempty"`
Date int `json:"date,omitempty"`
Chat Chat `json:"chat,omitempty"`
ForwardFrom *User `json:"forward_from,omitempty"`
ForwardFromChat *Chat `json:"forward_from_chat,omitempty"`
ForwardFromMessageId int `json:"forward_from_message_id,omitempty"`
ForwardSignature string `json:"forward_signature,omitempty"`
ForwardSenderName string `json:"forward_sender_name,omitempty"`
ForwardDate int `json:"forward_date,omitempty"`
ReplyToMessage *Message `json:"reply_to_message,omitempty"`
ViaBot *User `json:"via_bot,omitempty"`
EditDate int `json:"edit_date,omitempty"`
MediaGroupId string `json:"media_group_id,omitempty"`
AuthorSignature string `json:"author_signature,omitempty"`
Text string `json:"text,omitempty"`
Entities []MessageEntity `json:"entities,omitempty"`
Animation *Animation `json:"animation,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"`
VideoNote *VideoNote `json:"video_note,omitempty"`
Voice *Voice `json:"voice,omitempty"`
Caption string `json:"caption,omitempty"`
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
Contact *Contact `json:"contact,omitempty"`
Dice *Dice `json:"dice,omitempty"`
Game *Game `json:"game,omitempty"`
Poll *Poll `json:"poll,omitempty"`
Venue *Venue `json:"venue,omitempty"`
Location *Location `json:"location,omitempty"`
NewChatMembers []User `json:"new_chat_members,omitempty"`
LeftChatMember *User `json:"left_chat_member,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"`
SupergroupChatCreated bool `json:"supergroup_chat_created,omitempty"`
ChannelChatCreated bool `json:"channel_chat_created,omitempty"`
MessageAutoDeleteTimerChanged *MessageAutoDeleteTimerChanged `json:"message_auto_delete_timer_changed,omitempty"`
MigrateToChatId int `json:"migrate_to_chat_id,omitempty"`
MigrateFromChatId int `json:"migrate_from_chat_id,omitempty"`
PinnedMessage *Message `json:"pinned_message,omitempty"`
Invoice *Invoice `json:"invoice,omitempty"`
SuccessfulPayment *SuccessfulPayment `json:"successful_payment,omitempty"`
ConnectedWebsite string `json:"connected_website,omitempty"`
PassportData *PassportData `json:"passport_data,omitempty"`
ProximityAlertTriggered *ProximityAlertTriggered `json:"proximity_alert_triggered,omitempty"`
VoiceChatScheduled *VoiceChatScheduled `json:"voice_chat_scheduled,omitempty"`
VoiceChatStarted *VoiceChatStarted `json:"voice_chat_started,omitempty"`
VoiceChatEnded *VoiceChatEnded `json:"voice_chat_ended,omitempty"`
VoiceChatParticipantsInvited *VoiceChatParticipantsInvited `json:"voice_chat_participants_invited,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
type MessageAutoDeleteTimerChanged ¶
type MessageAutoDeleteTimerChanged struct {
MessageAutoDeleteTime int `json:"message_auto_delete_time,omitempty"`
}
type MessageEntity ¶
type OrderInfo ¶
type OrderInfo struct {
Name string `json:"name,omitempty"`
PhoneNumber string `json:"phone_number,omitempty"`
Email string `json:"email,omitempty"`
ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"`
}
type PassportData ¶
type PassportData struct {
// contains filtered or unexported fields
}
type PassportFile ¶
type Poll ¶
type Poll struct {
Id string `json:"id,omitempty"`
Question string `json:"question,omitempty"`
Options []PollOption `json:"options,omitempty"`
TotalVoterCount int `json:"total_voter_count,omitempty"`
IsClosed bool `json:"is_closed,omitempty"`
IsAnonymous bool `json:"is_anonymous,omitempty"`
Type string `json:"type,omitempty"`
AllowsMultipleAnswers bool `json:"allows_multiple_answers,omitempty"`
CorrectOptionId int `json:"correct_option_id,omitempty"`
Explanation string `json:"explanation,omitempty"`
ExplanationEntities []MessageEntity `json:"explanation_entities,omitempty"`
OpenPeriod int `json:"open_period,omitempty"`
CloseDate int `json:"close_date,omitempty"`
}
type PollAnswer ¶
type PollAnswer struct {
PollId string `json:"poll_id,omitempty"`
// contains filtered or unexported fields
}
type PollOption ¶
type PreCheckoutQuery ¶
type PreCheckoutQuery struct {
Id string `json:"id,omitempty"`
From User `json:"from,omitempty"`
Currency string `json:"currency,omitempty"`
TotalAmount int `json:"total_amount,omitempty"`
InvoicePayload string `json:"invoice_payload,omitempty"`
ShippingOptionId string `json:"shipping_option_id,omitempty"`
OrderInfo *OrderInfo `json:"order_info,omitempty"`
}
type ProximityAlertTriggered ¶
type ReplyKeyboardMarkup ¶
type ReplyKeyboardMarkup struct {
Keyboard [][]KeyboardButton `json:"keyboard,omitempty"`
ResizeKeyboard bool `json:"resize_keyboard,omitempty"`
OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"`
Selective bool `json:"selective,omitempty"`
}
type ReplyMarkup ¶
type ReplyMarkup struct {
InlineKeyboardMarkup InlineKeyboardMarkup `json:"inline_keyboard,omitempty"`
ReplyKeyboardMarkup ReplyKeyboardMarkup `json:"keyboard,omitempty"`
ForceReply bool `json:"force_reply,omitempty"`
ReplyKeyboardRemove bool `json:"remove_keyboard,omitempty"`
Selective bool `json:"selective,omitempty"`
}
type ShippingAddress ¶
type ShippingAddress struct {
CountryCode string `json:"country_code,omitempty"`
State string `json:"state,omitempty"`
City string `json:"city,omitempty"`
StreetLine1 string `json:"street_line1,omitempty"`
StreetLine2 string `json:"street_line2,omitempty"`
PostCode string `json:"post_code,omitempty"`
}
type ShippingQuery ¶
type ShippingQuery struct {
Id string `json:"id,omitempty"`
From User `json:"from,omitempty"`
InvoicePayload string `json:"invoice_payload,omitempty"`
ShippingAddress ShippingAddress `json:"shipping_address,omitempty"`
}
type Sticker ¶
type Sticker struct {
FileId string `json:"file_id,omitempty"`
FileUniqueId string `json:"file_unique_id,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
IsAnimated bool `json:"is_animated,omitempty"`
Thumb *PhotoSize `json:"thumb,omitempty"`
Emoji string `json:"emoji,omitempty"`
SetName string `json:"set_name,omitempty"`
MaskPosition *MaskPosition `json:"mask_position,omitempty"`
FileSize int `json:"file_size,omitempty"`
}
type SuccessfulPayment ¶
type SuccessfulPayment struct {
Currency string `json:"currency,omitempty"`
TotalAmount int64 `json:"total_amount,omitempty"`
InvoicePayload string `json:"invoice_payload,omitempty"`
ShippingOptionId string `json:"shipping_option_id,omitempty"`
OrderInfo *OrderInfo `json:"order_info,omitempty"`
TelegramPaymentChargeId string `json:"telegram_payment_charge_id,omitempty"`
ProviderPaymentChargeId string `json:"provider_payment_charge_id,omitempty"`
}
type Telepher ¶
type Telepher struct {
Token string
BaseURL string
BaseFileURL string
Client *http.Client
ParseMode string
Update chan Update
DisableTokenCheck bool
Self *User
}
func (Telepher) GetUpdates ¶
func (Telepher) SendMessage ¶
type Update ¶
type Update struct {
UpdateID int `json:"update_id,omitempty"`
Message *Message `json:"message,omitempty"`
EditedMessage *Message `json:"edited_message,omitempty"`
ChannelPost *Message `json:"channel_post,omitempty"`
EditedChannelPost *Message `json:"edited_channel_post,omitempty"`
InlineQuery *InlineQuery `json:"inline_query,omitempty"`
ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result,omitempty"`
CallbackQuery *CallbackQuery `json:"callback_query,omitempty"`
ShippingQuery *ShippingQuery `json:"shipping_query,omitempty"`
PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query,omitempty"`
Poll *Poll `json:"poll,omitempty"`
PollAnswer *PollAnswer `json:"poll_answer,omitempty"`
MyChatMember *ChatMemberUpdated `json:"my_chat_member,omitempty"`
ChatMember *ChatMemberUpdated `json:"chat_member,omitempty"`
}
type User ¶
type User struct {
ID int64 `json:"id,omitempty"`
IsBot bool `json:"is_bot,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
UserName string `json:"username,omitempty"`
LanguageCode string `json:"language_code,omitempty"`
CanJoinGroups bool `json:"can_join_groups,omitempty"`
CanReadAllGroupMessages bool `json:"can_read_all_group_messages,omitempty"`
SupportsInlineQueries bool `json:"supports_inline_queries,omitempty"`
}
type Venue ¶
type Venue struct {
Location Location `json:"location,omitempty"`
Title string `json:"title,omitempty"`
Address string `json:"address,omitempty"`
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"`
}
type Video ¶
type Video struct {
FileId string `json:"file_id,omitempty"`
FileUniqueId string `json:"file_unique_id,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
Duration int `json:"duration,omitempty"`
Thumb *PhotoSize `json:"thumb,omitempty"`
FileName string `json:"file_name,omitempty"`
MimeType string `json:"mime_type,omitempty"`
FileSize int64 `json:"file_size,omitempty"`
}
type VoiceChatEnded ¶
type VoiceChatEnded struct {
Duration int `json:"duration,omitempty"`
}
type VoiceChatParticipantsInvited ¶
type VoiceChatParticipantsInvited struct {
Users []User `json:"users,omitempty"`
}
type VoiceChatScheduled ¶
type VoiceChatScheduled struct {
StartDate int `json:"start_date,omitempty"`
}
type VoiceChatStarted ¶
type VoiceChatStarted struct{}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.