(new): rich message support
Golang lint / lint (pull_request) Successful in 1m20s
Golang lint / lint (push) Successful in 4m8s

(fix): runtime reliability
(tests): regression coverage
(doc): v1.1 release notes
This commit is contained in:
2026-08-12 16:34:44 +03:00
parent 48ddf66540
commit f03a081ed6
83 changed files with 6122 additions and 1925 deletions
+37 -3
View File
@@ -130,6 +130,20 @@ func (bot *Bot[T]) prepareUpdateCtx(u *tgapi.Update, ctx *MessageContext) {
from = u.EditedBusinessMessage.From
}
}
case tgapi.UpdateTypeGuestMessage:
if u.GuestMessage != nil {
ctx.Msg = u.GuestMessage
if u.GuestMessage.Chat != nil {
chat = u.GuestMessage.Chat
}
if u.GuestMessage.From != nil {
from = u.GuestMessage.From
}
}
case tgapi.UpdateTypeDeletedBusinessMessages:
if u.DeletedBusinessMessages != nil {
chat = &u.DeletedBusinessMessages.Chat
}
case tgapi.UpdateTypeInlineQuery:
if u.InlineQuery != nil {
from = &u.InlineQuery.From
@@ -187,23 +201,43 @@ func (bot *Bot[T]) prepareUpdateCtx(u *tgapi.Update, ctx *MessageContext) {
}
case tgapi.UpdateTypePollAnswer:
if u.PollAnswer != nil {
from = &u.PollAnswer.User
if u.PollAnswer.User.ID != 0 {
from = &u.PollAnswer.User
} else if u.PollAnswer.VoterChat.ID != 0 {
chat = &u.PollAnswer.VoterChat
}
}
case tgapi.UpdateTypeMessageReaction:
if u.MessageReaction != nil {
from = u.MessageReaction.User
chat = u.MessageReaction.Chat
}
case tgapi.UpdateTypeMessageReactionCount:
if u.MessageReactionCount != nil {
chat = u.MessageReactionCount.Chat
}
case tgapi.UpdateTypeChatBoost:
if u.ChatBoost != nil {
from = &u.ChatBoost.Boost.Source.User
if u.ChatBoost.Boost.Source.User.ID != 0 {
from = &u.ChatBoost.Boost.Source.User
}
chat = &u.ChatBoost.Chat
}
case tgapi.UpdateTypeRemovedChatBoost:
if u.RemovedChatBoost != nil {
from = &u.RemovedChatBoost.Source.User
if u.RemovedChatBoost.Source.User.ID != 0 {
from = &u.RemovedChatBoost.Source.User
}
chat = &u.RemovedChatBoost.Chat
}
case tgapi.UpdateTypeManagedBot:
if u.ManagedBot != nil {
from = &u.ManagedBot.User
}
case tgapi.UpdateTypeSubscription:
if u.Subscription != nil {
from = &u.Subscription.User
}
}
if ctx.Msg != nil && from == nil {
from = ctx.Msg.From