context: implement Bot function

pull/447/head
Demian 3 years ago
parent c720c43f56
commit ae69423c6e

@ -14,6 +14,9 @@ type HandlerFunc func(Context) error
// Context represents a context of the current event. It stores data
// depending on its type, whether it's a message, callback or whatever.
type Context interface {
// Bot returns the bot instance.
Bot() *Bot
// Message returns stored message if such presented.
Message() *Message
@ -159,6 +162,10 @@ type nativeContext struct {
store map[string]interface{}
}
func (c *nativeContext) Bot() *Bot {
return c.b
}
func (c *nativeContext) Message() *Message {
switch {
case c.message != nil:

Loading…
Cancel
Save