Merge pull request #429 from Rostish/v3

Chat() *Chat logic expanded
This commit is contained in:
demget 2021-07-28 23:34:09 +03:00 committed by GitHub
commit 346b6bfe9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -37,10 +37,10 @@ func (c *ChatInviteLink) ExpireDate() time.Time {
// ChatMemberUpdated object represents changes in the status of a chat member.
type ChatMemberUpdated struct {
// Chat where the user belongs to.
Chat Chat `json:"chat"`
Chat *Chat `json:"chat"`
// From which user the action was triggered.
From User `json:"from"`
From *User `json:"from"`
// Unixtime, use ChatMemberUpdated.Time() to get time.Time
Unixtime int64 `json:"date"`

View File

@ -240,6 +240,10 @@ func (c *nativeContext) Chat() *Chat {
return c.message.Chat
case c.callback != nil && c.callback.Message != nil:
return c.callback.Message.Chat
case c.myChatMember != nil:
return c.myChatMember.Chat
case c.chatMember != nil:
return c.chatMember.Chat
default:
return nil
}