(new): support Bot API 10.3
Golang lint / lint (push) Failing after 1m37s

(fix): finalize v2 contracts
(tests): cover v2 migration
(doc): prepare release guidance
This commit is contained in:
2026-09-08 23:21:38 +03:00
parent 24040fe164
commit d78526242b
88 changed files with 2321 additions and 918 deletions
+10 -5
View File
@@ -3,7 +3,7 @@ package laniakea
import (
"time"
"git.scuroneko.dev/scuroneko/laniakea/tgapi"
"git.scuroneko.dev/scuroneko/laniakea/v2/tgapi"
)
func (bot *Bot[T]) handleUpdate(u *tgapi.Update, ctx *MessageContext) bool {
@@ -201,10 +201,11 @@ func (bot *Bot[T]) prepareUpdateCtx(u *tgapi.Update, ctx *MessageContext) {
}
case tgapi.UpdateTypePollAnswer:
if u.PollAnswer != nil {
if voter, ok := u.PollAnswer.VoterUser(); ok {
from = voter
} else if voterChat, ok := u.PollAnswer.VoterChatInfo(); ok {
chat = voterChat
if u.PollAnswer.User != nil {
from = u.PollAnswer.User
}
if u.PollAnswer.VoterChat != nil {
chat = u.PollAnswer.VoterChat
}
}
case tgapi.UpdateTypeMessageReaction:
@@ -238,6 +239,10 @@ func (bot *Bot[T]) prepareUpdateCtx(u *tgapi.Update, ctx *MessageContext) {
if u.Subscription != nil {
from = &u.Subscription.User
}
case tgapi.UpdateTypeMessageGenerationStopped:
if u.StoppedMessageGeneration != nil {
chat = &u.StoppedMessageGeneration.Chat
}
}
if ctx.Msg != nil && from == nil {
from = ctx.Msg.From