all repos — telegram-bot-api @ 8806fb3badd2d68d3434c609f00f7f444a80901a

Golang bindings for the Telegram Bot API

Update types.go
Syfaro syfaro@huefox.com
Mon, 08 Nov 2021 12:37:50 -0800
commit

8806fb3badd2d68d3434c609f00f7f444a80901a

parent

01e6fd26dd0cb3f3614caa8508cae9f0c6a57d8e

1 files changed, 4 insertions(+), 2 deletions(-)

jump to
M types.gotypes.go

@@ -76,8 +76,8 @@ // optional

PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query"` } -// SentFrom return user sender of update. Can be nil, if telegram wont provide info about him in -// update object. +// SentFrom returns the user who sent an update. Can be nil, if Telegram did not provide information +// about the user in the update object. func (u *Update) SentFrom() *User { switch { case u.Message != nil:

@@ -99,6 +99,7 @@ return nil

} } +// CallbackData returns the callback query data, if it exists. func (u *Update) CallbackData() string { if u.CallbackQuery != nil { return u.CallbackQuery.Data

@@ -106,6 +107,7 @@ }

return "" } +// FromChat returns the chat where an update occured. func (u *Update) FromChat() *Chat { switch { case u.Message != nil: