Skip to content

Commit

Permalink
feat: return business in Update.Msg()
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-linch committed Apr 29, 2024
1 parent 3114ee0 commit ece7c55
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions types_gen_ext.go
Original file line number Diff line number Diff line change
Expand Up @@ -1250,6 +1250,10 @@ func (update *Update) Msg() *Message {
return update.EditedChannelPost
case update.CallbackQuery != nil && update.CallbackQuery.Message != nil && update.CallbackQuery.Message.Message != nil:
return update.CallbackQuery.Message.Message
case update.BusinessMessage != nil:
return update.BusinessMessage
case update.EditedBusinessMessage != nil:
return update.EditedBusinessMessage
default:
return nil
}
Expand Down
2 changes: 2 additions & 0 deletions types_gen_ext_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,8 @@ func TestUpdate_Msg(t *testing.T) {
Message: msg,
}}}, msg},
{&Update{CallbackQuery: &CallbackQuery{}}, nil},
{&Update{BusinessMessage: msg}, msg},
{&Update{EditedBusinessMessage: msg}, msg},
} {
assert.Equal(t, test.Message, test.Update.Msg())
}
Expand Down

0 comments on commit ece7c55

Please sign in to comment.