Documentation ¶
Index ¶
- type Context
- func (c *Context) AnswerCallbackQuery(options ...method.AnswerCallbackQueryOption) (bool, error)
- func (c *Context) CallbackQuery() *types.CallbackQuery
- func (c *Context) ChannelPost() *types.Message
- func (c *Context) Chat() *types.Chat
- func (c *Context) ChatID() int64
- func (c *Context) ChosenInlineResult() *types.ChosenInlineResult
- func (c *Context) DeleteChatPhoto() (bool, error)
- func (c *Context) DeleteChatStickerSet() (bool, error)
- func (c *Context) DeleteMessage(messageID int) (bool, error)
- func (c *Context) EditMessageCaption(caption args.TextData, options ...method.EditMessageCaptionOption) (*types.Message, error)
- func (c *Context) EditMessageMedia(media args.InputMediaConfig, options ...method.EditMessageMediaOption) (*types.Message, error)
- func (c *Context) EditMessageReplyMarkup(kb keyboard.Keyboard) (*types.Message, error)
- func (c *Context) EditMessageText(text args.TextData, options ...method.EditMessageTextOption) (*types.Message, error)
- func (c *Context) EditedChannelPost() *types.Message
- func (c *Context) EditedMessage() *types.Message
- func (c *Context) ExportChatInviteLink() (string, error)
- func (c *Context) From() *types.User
- func (c *Context) GetChat() (types.Chat, error)
- func (c *Context) GetChatAdministrators() (types.ChatMember, error)
- func (c *Context) GetChatMember(userID int) (types.ChatMember, error)
- func (c *Context) GetChatMembersCount() (int, error)
- func (c *Context) InlineQuery() *types.InlineQuery
- func (c *Context) KickChatMember(userID int, options ...method.KickChatMemberOption) (bool, error)
- func (c *Context) LeaveChat() (bool, error)
- func (c *Context) Message() *types.Message
- func (c *Context) PinChatMessage(messageID int, options ...method.PinChatMessageOption) (bool, error)
- func (c *Context) PreCheckoutQuery() *types.PreCheckoutQuery
- func (c *Context) PromoteChatMember(userID int, options ...method.PromoteChatMemberOption) (bool, error)
- func (c *Context) Reply(text args.TextData, options ...method.SendMessageOption) (types.Message, error)
- func (c *Context) ReplyWithAnimation(animation *args.AnimationConfig, options ...method.SendAnimationOption) (types.Message, error)
- func (c *Context) ReplyWithAudio(audio *args.AudioConfig, options ...method.SendAudioOption) (types.Message, error)
- func (c *Context) ReplyWithChatAction(action types.ChatAction) (types.Message, error)
- func (c *Context) ReplyWithContact(contact types.Contact, options ...method.SendContactOption) (types.Message, error)
- func (c *Context) ReplyWithDocument(document *args.DocumentConfig, options ...method.SendDocumentOption) (types.Message, error)
- func (c *Context) ReplyWithLocation(location types.Location, options ...method.SendLocationOption) (types.Message, error)
- func (c *Context) ReplyWithMediaGroup(mediaGroup []args.MediaGroupConfig, options ...method.SendMediaGroupOption) (types.Message, error)
- func (c *Context) ReplyWithPhoto(photo *args.PhotoConfig, options ...method.SendPhotoOption) (types.Message, error)
- func (c *Context) ReplyWithVenue(venue types.Venue, options ...method.SendVenueOption) (types.Message, error)
- func (c *Context) ReplyWithVideo(video *args.VideoConfig, options ...method.SendVideoOption) (types.Message, error)
- func (c *Context) ReplyWithVideoNote(videoNote *args.VideoNoteConfig, options ...method.SendVideoNoteOption) (types.Message, error)
- func (c *Context) ReplyWithVoice(voice *args.VoiceConfig, options ...method.SendVoiceOption) (types.Message, error)
- func (c *Context) RestrictChatMember(userID int, options ...method.RestrictChatMemberOption) (bool, error)
- func (c *Context) SetChatDescription(description string) (bool, error)
- func (c *Context) SetChatPhoto(file *os.File) (bool, error)
- func (c *Context) SetChatStickerSet(stickerSetName string) (bool, error)
- func (c *Context) SetChatTitle(title string) (bool, error)
- func (c *Context) ShippingQuery() *types.ShippingQuery
- func (c *Context) Telegram() telegram.Telegram
- func (c *Context) UnbanChatMember(userID int) (bool, error)
- func (c *Context) UnpinChatMessage() (bool, error)
- func (c *Context) Update() types.Update
- type Dispatcher
- type Gogram
- func (g *Gogram) OnAnimation(handler Handler)
- func (g *Gogram) OnAudio(handler Handler)
- func (g *Gogram) OnCallback(path string, handler Handler)
- func (g *Gogram) OnCallbackQuery(handler Handler)
- func (g *Gogram) OnChosenInlineResult(handler Handler)
- func (g *Gogram) OnCommand(command string, handler Handler)
- func (g *Gogram) OnContact(handler Handler)
- func (g *Gogram) OnDeleteChatPhoto(handler Handler)
- func (g *Gogram) OnDocument(handler Handler)
- func (g *Gogram) OnEditedMessage(handler Handler)
- func (g *Gogram) OnHelp(handler Handler)
- func (g *Gogram) OnInlineQuery(handler Handler)
- func (g *Gogram) OnInvoice(handler Handler)
- func (g *Gogram) OnLeftChatMember(handler Handler)
- func (g *Gogram) OnLocation(handler Handler)
- func (g *Gogram) OnMessage(handler Handler)
- func (g *Gogram) OnNewChatMembers(handler Handler)
- func (g *Gogram) OnNewChatPhoto(handler Handler)
- func (g *Gogram) OnPath(path string, handler Handler)
- func (g *Gogram) OnPhoto(handler Handler)
- func (g *Gogram) OnPreCheckoutQuery(handler Handler)
- func (g *Gogram) OnShippingQuery(handler Handler)
- func (g *Gogram) OnStart(handler Handler)
- func (g *Gogram) OnSticker(handler Handler)
- func (g *Gogram) OnSuccessfulPayment(handler Handler)
- func (g *Gogram) OnText(handler Handler)
- func (g *Gogram) OnUpdate(ut types.UpdateType, handler Handler)
- func (g *Gogram) OnVenue(handler Handler)
- func (g *Gogram) OnVideo(handler Handler)
- func (g *Gogram) OnVideoNote(handler Handler)
- func (g *Gogram) OnVoice(handler Handler)
- func (g *Gogram) StartPolling()
- func (g *Gogram) StopPolling()
- type Handler
- type Poller
- type Storage
- type Tree
- func (t *Tree) Delete(s string) (Handler, bool)
- func (t *Tree) DeletePrefix(s string) int
- func (t *Tree) Get(s string) (Handler, bool)
- func (t *Tree) Insert(s string, v Handler) (Handler, bool)
- func (t *Tree) Len() int
- func (t *Tree) LongestPrefix(s string) (string, Handler, bool)
- func (t *Tree) Maximum() (string, Handler, bool)
- func (t *Tree) Minimum() (string, Handler, bool)
- func (t *Tree) ToMap() map[string]Handler
- func (t *Tree) Walk(fn WalkFn)
- func (t *Tree) WalkPath(path string, fn WalkFn)
- func (t *Tree) WalkPrefix(prefix string, fn WalkFn)
- type WalkFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct { State map[string]interface{} // contains filtered or unexported fields }
Context its gogram context.
func NewContext ¶
NewContext creates context.
func (*Context) AnswerCallbackQuery ¶
func (c *Context) AnswerCallbackQuery(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 (*Context) CallbackQuery ¶
func (c *Context) CallbackQuery() *types.CallbackQuery
CallbackQuery returns edited message.
func (*Context) ChannelPost ¶
ChannelPost returns edited message.
func (*Context) ChosenInlineResult ¶
func (c *Context) ChosenInlineResult() *types.ChosenInlineResult
ChosenInlineResult returns edited message.
func (*Context) DeleteChatPhoto ¶
DeleteChatPhoto performs deleteChatPhoto telegram api method.
Reference: https://core.telegram.org/bots/api#deletechatphoto
func (*Context) DeleteChatStickerSet ¶
DeleteChatStickerSet performs deleteChatStickerSet telegram api method.
Reference: https://core.telegram.org/bots/api#deletechatstickerset
func (*Context) DeleteMessage ¶
DeleteMessage performs deleteMessage telegram api method.
func (*Context) EditMessageCaption ¶
func (c *Context) EditMessageCaption(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 otherwise.
options:
option.Keyboard(keyboard markup.Keyboard)
Reference: https://core.telegram.org/bots/api#editmessagecaption
func (*Context) EditMessageMedia ¶
func (c *Context) EditMessageMedia(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 otherwise.
options:
option.Keyboard(keyboard markup.Keyboard)
Reference: https://core.telegram.org/bots/api#editmessagemedia
func (*Context) EditMessageReplyMarkup ¶
EditMessageReplyMarkup performs editMessageReplyMarkup telegram api method. Returns pointer to the message, if message was sent by the bot or nil-pointer otherwise.
options:
option.Keyboard(keyboard markup.Keyboard)
Reference: https://core.telegram.org/bots/api#editmessagereplymarkup
func (*Context) EditMessageText ¶
func (c *Context) EditMessageText(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 otherwise.
options:
option.DisableWebPagePreview(), option.Keyboard(keyboard markup.Keyboard)
Reference: https://core.telegram.org/bots/api#editmessagetext
func (*Context) EditedChannelPost ¶
EditedChannelPost returns edited message.
func (*Context) EditedMessage ¶
EditedMessage returns edited message.
func (*Context) ExportChatInviteLink ¶
ExportChatInviteLink performs exportChatInviteLink telegram api method.
Reference: https://core.telegram.org/bots/api#exportchatinvitelink
func (*Context) GetChat ¶
GetChat performs getChat telegram api method.
Reference: https://core.telegram.org/bots/api#getchat
func (*Context) GetChatAdministrators ¶
func (c *Context) GetChatAdministrators() (types.ChatMember, error)
GetChatAdministrators performs getChatAdministrators telegram api method.
Reference: https://core.telegram.org/bots/api#getchatadministrators
func (*Context) GetChatMember ¶
func (c *Context) GetChatMember(userID int) (types.ChatMember, error)
GetChatMember performs getChatMember telegram api method.
func (*Context) GetChatMembersCount ¶
GetChatMembersCount performs getChatMembersCount telegram api method.
Reference: https://core.telegram.org/bots/api#getchatmemberscount
func (*Context) InlineQuery ¶
func (c *Context) InlineQuery() *types.InlineQuery
InlineQuery returns edited message.
func (*Context) KickChatMember ¶
KickChatMember performs kickChatMember telegram api method.
options:
option.UntilDate(date int)
Reference: https://core.telegram.org/bots/api#kickchatmember TODO: swap userID <-> ChatID in params
func (*Context) LeaveChat ¶
LeaveChat performs leaveChat telegram api method.
Reference: https://core.telegram.org/bots/api#leavechat
func (*Context) PinChatMessage ¶
func (c *Context) PinChatMessage(messageID int, options ...method.PinChatMessageOption) (bool, error)
PinChatMessage performs pinChatMessage telegram api method.
Reference: https://core.telegram.org/bots/api#pinchatmessage
func (*Context) PreCheckoutQuery ¶
func (c *Context) PreCheckoutQuery() *types.PreCheckoutQuery
PreCheckoutQuery returns edited message.
func (*Context) PromoteChatMember ¶
func (c *Context) PromoteChatMember(userID int, 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
func (*Context) Reply ¶
func (c *Context) Reply(text args.TextData, options ...method.SendMessageOption) (types.Message, error)
Reply performs sendMessage telegram api method.
options:
option.DisableWebPagePreview(), option.DisableNotification() option.ReplyToMessageID(id int), option.Keyboard(keyboard markup.Keyboard)
func (*Context) ReplyWithAnimation ¶
func (c *Context) ReplyWithAnimation(animation *args.AnimationConfig, options ...method.SendAnimationOption) (types.Message, error)
ReplyWithAnimation performs sendAnimation telegram api method.
options:
option.DisableWebPagePreview(), option.ReplyToMessageID(id int), option.Keyboard(keyboard markup.Keyboard)
func (*Context) ReplyWithAudio ¶
func (c *Context) ReplyWithAudio(audio *args.AudioConfig, options ...method.SendAudioOption) (types.Message, error)
ReplyWithAudio 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 (*Context) ReplyWithChatAction ¶
ReplyWithChatAction performs sendChatAction telegram api method.
Reference: https://core.telegram.org/bots/api#sendchataction
func (*Context) ReplyWithContact ¶
func (c *Context) ReplyWithContact(contact types.Contact, options ...method.SendContactOption) (types.Message, error)
ReplyWithContact performs sendContact telegram api method.
options:
option.DisableWebPagePreview(), option.ReplyToMessageID(id int), option.Keyboard(keyboard markup.Keyboard)
func (*Context) ReplyWithDocument ¶
func (c *Context) ReplyWithDocument(document *args.DocumentConfig, options ...method.SendDocumentOption) (types.Message, error)
ReplyWithDocument performs sendDocument telegram api method.
options:
option.DisableWebPagePreview(), option.ReplyToMessageID(id int), option.Keyboard(keyboard markup.Keyboard)
func (*Context) ReplyWithLocation ¶
func (c *Context) ReplyWithLocation(location types.Location, options ...method.SendLocationOption) (types.Message, error)
ReplyWithLocation performs sendLocation telegram api method.
options:
option.DisableWebPagePreview(), option.ReplyToMessageID(id int), option.Keyboard(keyboard markup.Keyboard)
func (*Context) ReplyWithMediaGroup ¶
func (c *Context) ReplyWithMediaGroup(mediaGroup []args.MediaGroupConfig, options ...method.SendMediaGroupOption) (types.Message, error)
ReplyWithMediaGroup performs sendMediaGroup telegram api method.
options:
option.DisableWebPagePreview(), option.ReplyToMessageID(id int),
Reference: https://core.telegram.org/bots/api#sendmediagroup
func (*Context) ReplyWithPhoto ¶
func (c *Context) ReplyWithPhoto(photo *args.PhotoConfig, options ...method.SendPhotoOption) (types.Message, error)
ReplyWithPhoto 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 (*Context) ReplyWithVenue ¶
func (c *Context) ReplyWithVenue(venue types.Venue, options ...method.SendVenueOption) (types.Message, error)
ReplyWithVenue 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 (*Context) ReplyWithVideo ¶
func (c *Context) ReplyWithVideo(video *args.VideoConfig, options ...method.SendVideoOption) (types.Message, error)
ReplyWithVideo 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 (*Context) ReplyWithVideoNote ¶
func (c *Context) ReplyWithVideoNote(videoNote *args.VideoNoteConfig, options ...method.SendVideoNoteOption) (types.Message, error)
ReplyWithVideoNote performs sendVideoNote telegram api method.
options:
option.DisableWebPagePreview(), option.ReplyToMessageID(id int), option.Keyboard(keyboard markup.Keyboard)
func (*Context) ReplyWithVoice ¶
func (c *Context) ReplyWithVoice(voice *args.VoiceConfig, options ...method.SendVoiceOption) (types.Message, error)
ReplyWithVoice 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 (*Context) RestrictChatMember ¶
func (c *Context) RestrictChatMember(userID int, 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
func (*Context) SetChatDescription ¶
SetChatDescription performs setChatDescription telegram api method.
Reference: https://core.telegram.org/bots/api#setchatdescription
func (*Context) SetChatPhoto ¶
SetChatPhoto performs setChatPhoto telegram api method.
func (*Context) SetChatStickerSet ¶
SetChatStickerSet performs setChatStickerSet telegram api method.
Reference: https://core.telegram.org/bots/api#setchatstickerset
func (*Context) SetChatTitle ¶
SetChatTitle performs setChatTitle telegram api method.
func (*Context) ShippingQuery ¶
func (c *Context) ShippingQuery() *types.ShippingQuery
ShippingQuery returns edited message.
func (*Context) UnbanChatMember ¶
UnbanChatMember performs unbanChatMember telegram api method.
options:
option.UntilDate(date int)
Reference: https://core.telegram.org/bots/api#unbanchatmember
func (*Context) UnpinChatMessage ¶
UnpinChatMessage performs unpinChatMessage telegram api method.
Reference: https://core.telegram.org/bots/api#unpinchatmessage
type Dispatcher ¶
type Dispatcher interface { OnPath(string, Handler) OnUpdate(types.UpdateType, Handler) OnCallbackQuery(Handler) OnCallback(string, Handler) OnInlineQuery(Handler) OnShippingQuery(Handler) OnPreCheckoutQuery(Handler) OnChosenInlineResult(Handler) OnMessage(Handler) OnEditedMessage(Handler) OnText(Handler) OnAudio(Handler) OnDocument(Handler) OnAnimation(Handler) OnPhoto(Handler) OnSticker(Handler) OnVideo(Handler) OnVideoNote(Handler) OnVoice(Handler) OnContact(Handler) OnLocation(Handler) OnVenue(Handler) OnNewChatMembers(Handler) OnLeftChatMember(Handler) OnNewChatPhoto(Handler) OnDeleteChatPhoto(Handler) OnInvoice(Handler) OnSuccessfulPayment(Handler) OnCommand(string, Handler) OnStart(Handler) OnHelp(Handler) Handle(*Context) }
Dispatcher interface
type Gogram ¶
type Gogram struct {
// contains filtered or unexported fields
}
Gogram its a telegram bot framework
func (*Gogram) OnAnimation ¶
OnAnimation sets handler for animation message.
func (*Gogram) OnCallback ¶
OnCallback sets handler for specific callback query.
func (*Gogram) OnCallbackQuery ¶
OnCallbackQuery sets handler for callback query.
func (*Gogram) OnChosenInlineResult ¶
OnChosenInlineResult sets handler for chosen inline result.
func (*Gogram) OnDeleteChatPhoto ¶
OnDeleteChatPhoto sets handler for delete chat photo.
func (*Gogram) OnDocument ¶
OnDocument sets handler for document message.
func (*Gogram) OnEditedMessage ¶
OnEditedMessage sets handler for edited message.
func (*Gogram) OnInlineQuery ¶
OnInlineQuery sets handler for inline query.
func (*Gogram) OnLeftChatMember ¶
OnLeftChatMember sets handler for left chat member.
func (*Gogram) OnLocation ¶
OnLocation sets handler for location message.
func (*Gogram) OnNewChatMembers ¶
OnNewChatMembers sets handler for new chat members.
func (*Gogram) OnNewChatPhoto ¶
OnNewChatPhoto sets handler for new chat photo.
func (*Gogram) OnPreCheckoutQuery ¶
OnPreCheckoutQuery sets handler for pre checkout query.
func (*Gogram) OnShippingQuery ¶
OnShippingQuery sets handler for shipping query.
func (*Gogram) OnSuccessfulPayment ¶
OnSuccessfulPayment sets handler for successfull payment.
func (*Gogram) OnUpdate ¶
func (g *Gogram) OnUpdate(ut types.UpdateType, handler Handler)
OnUpdate sets handler for update type.
func (*Gogram) OnVideoNote ¶
OnVideoNote sets handler for video note message.
func (*Gogram) StartPolling ¶
func (g *Gogram) StartPolling()
StartPolling starts bot using long poling.
type Storage ¶
type Storage interface { Insert(string, Handler) Find(string) (Handler, bool) Map() map[string]Handler }
Storage interface
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree implements a radix tree. This can be treated as a Dictionary abstract data type. The main advantage over a standard hash map is prefix-based lookups and ordered iteration,
func NewTreeFromMap ¶
NewTreeFromMap returns a new tree containing the keys from an existing map
func (*Tree) Delete ¶
Delete is used to delete a key, returning the previous value and if it was deleted
func (*Tree) DeletePrefix ¶
DeletePrefix is used to delete the subtree under a prefix Returns how many nodes were deleted Use this to delete large subtrees efficiently
func (*Tree) Insert ¶
Insert is used to add a newentry or update an existing entry. Returns if updated.
func (*Tree) LongestPrefix ¶
LongestPrefix is like Get, but instead of an exact match, it will return the longest prefix match.
func (*Tree) WalkPath ¶
WalkPath is used to walk the tree, but only visiting nodes from the root down to a given leaf. Where WalkPrefix walks all the entries *under* the given prefix, this walks the entries *above* the given prefix.
func (*Tree) WalkPrefix ¶
WalkPrefix is used to walk the tree under a prefix