Skip to content

Commit

Permalink
context: return command payload on Data
Browse files Browse the repository at this point in the history
  • Loading branch information
demget committed Jun 21, 2021
1 parent 9c67c31 commit 55a27ad
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type Context interface {
Text() string

// Data returns the current data, depending on the context type.
// If the context contains command, returns its arguments string.
// If the context contains payment, returns its payload.
// In the case when no related data presented, returns an empty string.
Data() string
Expand Down Expand Up @@ -231,6 +232,8 @@ func (c *nativeContext) Text() string {

func (c *nativeContext) Data() string {
switch {
case c.message != nil:
return c.message.Payload
case c.callback != nil:
return c.callback.Data
case c.query != nil:
Expand Down

0 comments on commit 55a27ad

Please sign in to comment.