Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Populate effectiveX fields with reaction+chatboost data #149

Merged
merged 1 commit into from
Feb 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions ext/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ func NewContext(update *gotgbot.Update, data map[string]interface{}) *Context {
msg = update.EditedChannelPost
chat = &update.EditedChannelPost.Chat

case update.MessageReaction != nil:
user = update.MessageReaction.User
chat = &update.MessageReaction.Chat
sender = &gotgbot.Sender{
User: update.MessageReaction.User,
Chat: update.MessageReaction.ActorChat,
ChatId: update.MessageReaction.Chat.Id,
}

case update.MessageReactionCount != nil:
chat = &update.MessageReactionCount.Chat

case update.InlineQuery != nil:
user = &update.InlineQuery.From

Expand Down Expand Up @@ -93,6 +105,9 @@ func NewContext(update *gotgbot.Update, data map[string]interface{}) *Context {
case update.PreCheckoutQuery != nil:
user = &update.PreCheckoutQuery.From

case update.Poll != nil:
// no data

case update.PollAnswer != nil:
user = update.PollAnswer.User
sender = &gotgbot.Sender{User: update.PollAnswer.User, Chat: update.PollAnswer.VoterChat}
Expand All @@ -108,6 +123,14 @@ func NewContext(update *gotgbot.Update, data map[string]interface{}) *Context {
case update.ChatJoinRequest != nil:
user = &update.ChatJoinRequest.From
chat = &update.ChatJoinRequest.Chat

case update.ChatBoost != nil:
chat = &update.ChatBoost.Chat
user = update.ChatBoost.Boost.Source.MergeChatBoostSource().User

case update.RemovedChatBoost != nil:
chat = &update.RemovedChatBoost.Chat
user = update.RemovedChatBoost.Source.MergeChatBoostSource().User
}

if data == nil {
Expand Down
Loading