Skip to content

Commit cb12b17

Browse files
committed
telebot: add missed events
1 parent 1b1c30e commit cb12b17

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

bot.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,21 @@ func (b *Bot) ProcessUpdate(upd Update) {
349349
return
350350
}
351351

352+
if m.GroupCreated {
353+
b.handle(OnGroupCreated, c)
354+
return
355+
}
356+
357+
if m.SuperGroupCreated {
358+
b.handle(OnSuperGroupCreated, c)
359+
return
360+
}
361+
362+
if m.ChannelCreated {
363+
b.handle(OnChannelCreated, c)
364+
return
365+
}
366+
352367
if m.MigrateTo != 0 {
353368
m.MigrateFrom = m.Chat.ID
354369
b.handle(OnMigration, c)
@@ -507,6 +522,8 @@ func (b *Bot) handleMedia(c Context) bool {
507522
b.handle(OnLocation, c)
508523
case m.Venue != nil:
509524
b.handle(OnVenue, c)
525+
case m.Game != nil:
526+
b.handle(OnGame, c)
510527
case m.Dice != nil:
511528
b.handle(OnDice, c)
512529
default:

message.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ type Message struct {
117117
// For a poll, information the native poll.
118118
Poll *Poll `json:"poll"`
119119

120+
// For a game, information about it.
121+
Game *Game `json:"game"`
122+
120123
// For a dice, information about it.
121124
Dice *Dice `json:"dice"`
122125

@@ -216,9 +219,6 @@ type Message struct {
216219
// The domain name of the website on which the user has logged in.
217220
ConnectedWebsite string `json:"connected_website,omitempty"`
218221

219-
// Inline keyboard attached to the message.
220-
ReplyMarkup InlineKeyboardMarkup `json:"reply_markup"`
221-
222222
// For a service message, a voice chat started in the chat.
223223
VoiceChatStarted *VoiceChatStarted `json:"voice_chat_started,omitempty"`
224224

@@ -237,6 +237,9 @@ type Message struct {
237237

238238
// For a service message, represents about a change in auto-delete timer settings.
239239
AutoDeleteTimer *AutoDeleteTimer `json:"message_auto_delete_timer_changed,omitempty"`
240+
241+
// Inline keyboard attached to the message.
242+
ReplyMarkup InlineKeyboardMarkup `json:"reply_markup"`
240243
}
241244

242245
// MessageEntity object represents "special" parts of text messages,

telebot.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const (
6363
OnDice = "\adice"
6464
OnInvoice = "\ainvoice"
6565
OnPayment = "\apayment"
66+
OnGame = "\agame"
6667
OnPoll = "\apoll"
6768
OnPollAnswer = "\apoll_answer"
6869

@@ -73,12 +74,15 @@ const (
7374
// Will fire when bot is added to a group.
7475
OnAddedToGroup = "\aadded_to_group"
7576

76-
// Group events:
77+
// Service events:
7778
OnUserJoined = "\auser_joined"
7879
OnUserLeft = "\auser_left"
7980
OnNewGroupTitle = "\anew_chat_title"
8081
OnNewGroupPhoto = "\anew_chat_photo"
8182
OnGroupPhotoDeleted = "\achat_photo_deleted"
83+
OnGroupCreated = "\agroup_created"
84+
OnSuperGroupCreated = "\asupergroup_created"
85+
OnChannelCreated = "\achannel_created"
8286

8387
// Migration happens when group switches to
8488
// a supergroup. You might want to update

0 commit comments

Comments
 (0)