-
Notifications
You must be signed in to change notification settings - Fork 470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
context: implement RespondText,RespondAlert methods #660
Conversation
context.go
Outdated
@@ -152,6 +152,12 @@ type Context interface { | |||
// See Respond from bot.go. | |||
Respond(resp ...*CallbackResponse) error | |||
|
|||
// RespondText sends a popup response for the current callback query. | |||
RespondText(t string) error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
text string
context.go
Outdated
RespondText(t string) error | ||
|
||
// RespondAlert sends an alert response for the current callback query. | ||
RespondAlert(t string) error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
text string
context.go
Outdated
@@ -481,6 +487,14 @@ func (c *nativeContext) Respond(resp ...*CallbackResponse) error { | |||
return c.b.Respond(c.u.Callback, resp...) | |||
} | |||
|
|||
func (c *nativeContext) RespondText(t string) error { | |||
return c.respondTextAlert(t) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return c.Respond(&CallbackResponse{Text: text})
context.go
Outdated
} | ||
|
||
func (c *nativeContext) RespondAlert(t string) error { | ||
return c.respondTextAlert(t, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return c.Respond(&CallbackResponse{Text: text, Alert: true})
context.go
Outdated
if c.u.Callback == nil { | ||
return errors.New("telebot: context callback is nil") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c.Respond
already does this job, the implementation can be simpler.
Closes #627