(fix): finalize v2 contracts (tests): cover v2 migration (doc): prepare release guidance
This commit is contained in:
+10
-5
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user