Skip to content

Commit

Permalink
callbacks: handle both inline and regular messages in MessageSig
Browse files Browse the repository at this point in the history
  • Loading branch information
demget committed Jul 27, 2021
1 parent cdb2d59 commit 635f51c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 4 additions & 1 deletion callbacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ type Callback struct {

// MessageSig satisfies Editable interface.
func (c *Callback) MessageSig() (string, int64) {
return c.MessageID, 0
if c.IsInline() {
return c.MessageID, 0
}
return c.Message.MessageSig()
}

// IsInline says whether message is an inline message.
Expand Down
9 changes: 4 additions & 5 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,11 @@ func (c *nativeContext) Edit(what interface{}, opts ...interface{}) error {
_, err := c.b.Edit(c.inlineResult, what, opts...)
return err
}
clb := c.callback
if clb == nil || clb.Message == nil {
return ErrBadContext
if c.callback != nil {
_, err := c.b.Edit(c.callback, what, opts...)
return err
}
_, err := c.b.Edit(clb.Message, what, opts...)
return err
return ErrBadContext
}

func (c *nativeContext) EditCaption(caption string, opts ...interface{}) error {
Expand Down

0 comments on commit 635f51c

Please sign in to comment.