File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,30 @@ func (u *Update) SentFrom() *User {
9999 }
100100}
101101
102+ func (u * Update ) CallbackData () string {
103+ if u .CallbackQuery != nil {
104+ return u .CallbackQuery .Data
105+ }
106+ return ""
107+ }
108+
109+ func (u * Update ) FromChat () * Chat {
110+ switch {
111+ case u .Message != nil :
112+ return u .Message .Chat
113+ case u .EditedMessage != nil :
114+ return u .EditedMessage .Chat
115+ case u .ChannelPost != nil :
116+ return u .ChannelPost .Chat
117+ case u .EditedChannelPost != nil :
118+ return u .EditedChannelPost .Chat
119+ case u .CallbackQuery != nil :
120+ return u .CallbackQuery .Message .Chat
121+ default :
122+ return nil
123+ }
124+ }
125+
102126// UpdatesChannel is the channel for getting updates.
103127type UpdatesChannel <- chan Update
104128
You can’t perform that action at this time.
0 commit comments