telegram

package
v0.0.0-...-cc90098 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Telegram

type Telegram struct {
	// contains filtered or unexported fields
}

Telegram telegram.

func New

func New(token string) *Telegram

New creates Telegram.

func (*Telegram) AnswerCallbackQuery

func (t *Telegram) AnswerCallbackQuery(id string, options ...method.AnswerCallbackQueryOption) (bool, error)

AnswerCallbackQuery performs answerCallbackQuery telegram api method.

options:

option.Text(text string), option.ShowAlert(), option.URL(url string), option.CacheTime(time int)

Reference: https://core.telegram.org/bots/api#answercallbackquery

func (*Telegram) DeleteChatPhoto

func (t *Telegram) DeleteChatPhoto(chatID int64) (bool, error)

DeleteChatPhoto performs deleteChatPhoto telegram api method.

Reference: https://core.telegram.org/bots/api#deletechatphoto

func (*Telegram) DeleteChatStickerSet

func (t *Telegram) DeleteChatStickerSet(chatID int64) (bool, error)

DeleteChatStickerSet performs deleteChatStickerSet telegram api method.

Reference: https://core.telegram.org/bots/api#deletechatstickerset

func (*Telegram) DeleteMessage

func (t *Telegram) DeleteMessage(chatID int64, messageID int) (bool, error)

DeleteMessage performs deleteMessage telegram api method.

https://core.telegram.org/bots/api#deletemessage

func (*Telegram) EditMessageCaption

func (t *Telegram) EditMessageCaption(messageID *args.MessageID, caption args.TextData, options ...method.EditMessageCaptionOption) (*types.Message, error)

EditMessageCaption performs editMessageCaption telegram api method. Returns pointer to the message, if message was sent by the bot or nil-pointer.

options:

option.Keyboard(keyboard markup.Keyboard)

Reference: https://core.telegram.org/bots/api#editmessagecaption

func (*Telegram) EditMessageMedia

func (t *Telegram) EditMessageMedia(messageID *args.MessageID, media args.InputMediaConfig, options ...method.EditMessageMediaOption) (*types.Message, error)

EditMessageMedia performs editMessageMedia telegram api method. Returns pointer to the message, if message was sent by the bot or nil-pointer.

options:

option.Keyboard(keyboard markup.Keyboard)

Reference: https://core.telegram.org/bots/api#editmessagemedia

func (*Telegram) EditMessageReplyMarkup

func (t *Telegram) EditMessageReplyMarkup(messageID *args.MessageID, kb keyboard.Keyboard) (*types.Message, error)

EditMessageReplyMarkup performs editMessageReplyMarkup telegram api method. Returns pointer to the message, if message was sent by the bot or nil-pointer.

Reference: https://core.telegram.org/bots/api#editmessagereplymarkup

func (*Telegram) EditMessageText

func (t *Telegram) EditMessageText(messageID *args.MessageID, text args.TextData, options ...method.EditMessageTextOption) (*types.Message, error)

EditMessageText performs editMessageText telegram api method. Returns pointer to the message, if message was sent by the bot or nil-pointer.

options:

option.DisableWebPagePreview(), option.Keyboard(keyboard markup.Keyboard)

Reference: https://core.telegram.org/bots/api#editmessagetext

func (t *Telegram) ExportChatInviteLink(chatID int64) (string, error)

ExportChatInviteLink performs exportChatInviteLink telegram api method.

Reference: https://core.telegram.org/bots/api#exportchatinvitelink

func (*Telegram) ForwardMessage

func (t *Telegram) ForwardMessage(chatID, fromChatID, messageID int, options ...method.ForwardMessageOption) (types.Message, error)

ForwardMessage performs forwardMessage telegram api method.

options:

option.DisableNotification()

Reference: https://core.telegram.org/bots/api#forwardmessage

func (*Telegram) GetChat

func (t *Telegram) GetChat(chatID int64) (types.Chat, error)

GetChat performs getChat telegram api method.

Reference: https://core.telegram.org/bots/api#getchat

func (*Telegram) GetChatAdministrators

func (t *Telegram) GetChatAdministrators(chatID int64) (types.ChatMember, error)

GetChatAdministrators performs getChatAdministrators telegram api method.

Reference: https://core.telegram.org/bots/api#getchatadministrators TODO: results is array

func (*Telegram) GetChatMember

func (t *Telegram) GetChatMember(chatID int64, userID int) (types.ChatMember, error)

GetChatMember performs getChatMember telegram api method.

Reference: https://core.telegram.org/bots/api#getchatmember

func (*Telegram) GetChatMembersCount

func (t *Telegram) GetChatMembersCount(chatID int64) (int, error)

GetChatMembersCount performs getChatMembersCount telegram api method.

Reference: https://core.telegram.org/bots/api#getchatmemberscount

func (*Telegram) GetFile

func (t *Telegram) GetFile(fileID string) (types.File, error)

GetFile performs getFile telegram api method.

Reference: https://core.telegram.org/bots/api#getfile

func (*Telegram) GetMe

func (t *Telegram) GetMe() (types.User, error)

GetMe performs getMe telegram api method.

Reference: https://core.telegram.org/bots/api#getme

func (*Telegram) GetUpdates

func (t *Telegram) GetUpdates(options ...method.GetUpdatesOption) ([]types.Update, error)

GetUpdates performs getMe telegram api method.

Reference: https://core.telegram.org/bots/api#getupdates

func (*Telegram) GetUserProfilePhotos

func (t *Telegram) GetUserProfilePhotos(userID int, options ...method.GetUserProfilePhotosOption) (types.UserProfilePhotos, error)

GetUserProfilePhotos performs getUserProfilePhotos telegram api method.

options:

option.Offset(o int), option.Limit(l int)

Reference: https://core.telegram.org/bots/api#getuserprofilephotos

func (*Telegram) KickChatMember

func (t *Telegram) KickChatMember(userID int, chatID int64, options ...method.KickChatMemberOption) (bool, error)

KickChatMember performs kickChatMember telegram api method.

options:

option.UntilDate(date int)

Reference: https://core.telegram.org/bots/api#kickchatmember

func (*Telegram) LeaveChat

func (t *Telegram) LeaveChat(chatID int64) (bool, error)

LeaveChat performs leaveChat telegram api method.

Reference: https://core.telegram.org/bots/api#leavechat

func (*Telegram) PinChatMessage

func (t *Telegram) PinChatMessage(chatID int64, messageID int, options ...method.PinChatMessageOption) (bool, error)

PinChatMessage performs pinChatMessage telegram api method.

Reference: https://core.telegram.org/bots/api#pinchatmessage

func (*Telegram) PromoteChatMember

func (t *Telegram) PromoteChatMember(userID int, chatID int64, options ...method.PromoteChatMemberOption) (bool, error)

PromoteChatMember performs promoteChatMember telegram api method.

options:

option.CanChangeInfo(), option.CanPostMessages(), option.CanDeleteMessages(), option.CanEditMessages() option.CanInviteUsers(), option.CanRestrictUsers(), option.CanPinMessages(), option.CanPromoteMembers()

Reference: https://core.telegram.org/bots/api#promotechatmember TODO: rework true/false

func (*Telegram) RestrictChatMember

func (t *Telegram) RestrictChatMember(userID int, chatID int64, options ...method.RestrictChatMemberOption) (bool, error)

RestrictChatMember performs restrictChatMember telegram api method.

options:

option.CanSendMessages(), options.CanSendMediaMessages(), option.CanSendOtherMessages(), option.CanAddWebPagePreview()

Reference: https://core.telegram.org/bots/api#restrictchatmember TODO: rework true/false

func (*Telegram) SendAnimation

func (t *Telegram) SendAnimation(chatID int64, animation *args.AnimationConfig, options ...method.SendAnimationOption) (types.Message, error)

SendAnimation performs sendAnimation telegram api method.

options:

option.DisableWebPagePreview(), option.ReplyToMessageID(id int), option.Keyboard(keyboard markup.Keyboard)

Reference: https://core.telegram.org/bots/api#sendanimation

func (*Telegram) SendAudio

func (t *Telegram) SendAudio(chatID int64, audio *args.AudioConfig, options ...method.SendAudioOption) (types.Message, error)

SendAudio performs sendAudio telegram api method.

options:

option.DisableWebPagePreview(), option.ReplyToMessageID(id int), option.Keyboard(keyboard markup.Keyboard)

Reference: https://core.telegram.org/bots/api#sendaudio

func (*Telegram) SendChatAction

func (t *Telegram) SendChatAction(chatID int64, action types.ChatAction) (types.Message, error)

SendChatAction performs sendChatAction telegram api method.

Reference: https://core.telegram.org/bots/api#sendchataction

func (*Telegram) SendContact

func (t *Telegram) SendContact(chatID int64, contact types.Contact, options ...method.SendContactOption) (types.Message, error)

SendContact performs sendContact telegram api method.

options:

option.DisableWebPagePreview(), option.ReplyToMessageID(id int), option.Keyboard(keyboard markup.Keyboard)

Reference: https://core.telegram.org/bots/api#sendcontact

func (*Telegram) SendDocument

func (t *Telegram) SendDocument(chatID int64, document *args.DocumentConfig, options ...method.SendDocumentOption) (types.Message, error)

SendDocument performs sendDocument telegram api method.

options:

option.DisableWebPagePreview(), option.ReplyToMessageID(id int), option.Keyboard(keyboard markup.Keyboard)

Reference: https://core.telegram.org/bots/api#senddocument

func (*Telegram) SendLocation

func (t *Telegram) SendLocation(chatID int64, location types.Location, options ...method.SendLocationOption) (types.Message, error)

SendLocation performs sendLocation telegram api method.

options:

option.DisableWebPagePreview(), option.ReplyToMessageID(id int), option.Keyboard(keyboard markup.Keyboard)

Reference: https://core.telegram.org/bots/api#sendlocation

func (*Telegram) SendMediaGroup

func (t *Telegram) SendMediaGroup(chatID int64, mediaGroup []args.MediaGroupConfig, options ...method.SendMediaGroupOption) (types.Message, error)

SendMediaGroup performs sendMediaGroup telegram api method.

options:

option.DisableWebPagePreview(), option.ReplyToMessageID(id int),

Reference: https://core.telegram.org/bots/api#sendmediagroup TODO: parse response to array.

func (*Telegram) SendMessage

func (t *Telegram) SendMessage(chatID int64, text args.TextData, options ...method.SendMessageOption) (types.Message, error)

SendMessage performs sendMessage telegram api method.

options:

option.DisableWebPagePreview(), option.DisableNotification() option.ReplyToMessageID(id int), option.Keyboard(keyboard markup.Keyboard)

Reference: https://core.telegram.org/bots/api#sendmessage

func (*Telegram) SendPhoto

func (t *Telegram) SendPhoto(chatID int64, photo *args.PhotoConfig, options ...method.SendPhotoOption) (types.Message, error)

SendPhoto performs sendPhoto telegram api method.

options:

option.DisableWebPagePreview(), option.ReplyToMessageID(id int), option.Keyboard(keyboard markup.Keyboard)

Reference: https://core.telegram.org/bots/api#sendphoto

func (*Telegram) SendVenue

func (t *Telegram) SendVenue(chatID int64, venue types.Venue, options ...method.SendVenueOption) (types.Message, error)

SendVenue performs sendVenue telegram api method.

options:

option.DisableWebPagePreview(), option.ReplyToMessageID(id int), option.Keyboard(keyboard markup.Keyboard), option.Foursquare(id, type string)

Reference: https://core.telegram.org/bots/api#sendvenue

func (*Telegram) SendVideo

func (t *Telegram) SendVideo(chatID int64, video *args.VideoConfig, options ...method.SendVideoOption) (types.Message, error)

SendVideo performs sendVideo telegram api method.

options:

option.DisableWebPagePreview(), option.ReplyToMessageID(id int), option.Keyboard(keyboard markup.Keyboard)

Reference: https://core.telegram.org/bots/api#sendvideo

func (*Telegram) SendVideoNote

func (t *Telegram) SendVideoNote(chatID int64, videoNote *args.VideoNoteConfig, options ...method.SendVideoNoteOption) (types.Message, error)

SendVideoNote performs sendVideoNote telegram api method.

options:

option.DisableWebPagePreview(), option.ReplyToMessageID(id int), option.Keyboard(keyboard markup.Keyboard)

Reference: https://core.telegram.org/bots/api#sendvideonote

func (*Telegram) SendVoice

func (t *Telegram) SendVoice(chatID int64, voice *args.VoiceConfig, options ...method.SendVoiceOption) (types.Message, error)

SendVoice performs sendVoice telegram api method.

options:

option.DisableWebPagePreview(), option.ReplyToMessageID(id int), option.Keyboard(keyboard markup.Keyboard)

Reference: https://core.telegram.org/bots/api#sendvoice

func (*Telegram) SetChatDescription

func (t *Telegram) SetChatDescription(chatID int64, description string) (bool, error)

SetChatDescription performs setChatDescription telegram api method.

Reference: https://core.telegram.org/bots/api#setchatdescription

func (*Telegram) SetChatPhoto

func (t *Telegram) SetChatPhoto(chatID int64, file *os.File) (bool, error)

SetChatPhoto performs setChatPhoto telegram api method.

Reference: https://core.telegram.org/bots/api#setchatphoto

func (*Telegram) SetChatStickerSet

func (t *Telegram) SetChatStickerSet(chatID int64, stickerSetName string) (bool, error)

SetChatStickerSet performs setChatStickerSet telegram api method.

Reference: https://core.telegram.org/bots/api#setchatstickerset

func (*Telegram) SetChatTitle

func (t *Telegram) SetChatTitle(chatID int64, title string) (bool, error)

SetChatTitle performs setChatTitle telegram api method.

Reference: https://core.telegram.org/bots/api#setchattitle

func (*Telegram) UnbanChatMember

func (t *Telegram) UnbanChatMember(userID int, chatID int64) (bool, error)

UnbanChatMember performs unbanChatMember telegram api method.

options:

option.UntilDate(date int)

Reference: https://core.telegram.org/bots/api#unbanchatmember

func (*Telegram) UnpinChatMessage

func (t *Telegram) UnpinChatMessage(chatID int64) (bool, error)

UnpinChatMessage performs unpinChatMessage telegram api method.

Reference: https://core.telegram.org/bots/api#unpinchatmessage

Directories

Path Synopsis
internal
net
Package method implements all available telegram bot api methods.
Package method implements all available telegram bot api methods.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL