Skip to content

Commit

Permalink
Refactor updateTypeSwitch in telegram/helpers.go
Browse files Browse the repository at this point in the history
  • Loading branch information
AmarnathCJD committed Sep 25, 2024
1 parent de64fe0 commit 4a20a82
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions telegram/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,11 @@ updateTypeSwitch:
}
case *UpdatesObj:
upd := update.Updates[0]
if len(update.Updates) == 2 {
upd = update.Updates[1]
for _, u := range update.Updates {
switch u.(type) {
case *UpdateNewMessage, *UpdateNewChannelMessage, *UpdateEditMessage, *UpdateEditChannelMessage:
upd = u
}
}
switch upd := upd.(type) {
case *UpdateNewMessage:
Expand Down

0 comments on commit 4a20a82

Please sign in to comment.