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

MyChatMember event not works + solution to fix #9

Open
DelphiMan68 opened this issue Sep 13, 2024 · 0 comments
Open

MyChatMember event not works + solution to fix #9

DelphiMan68 opened this issue Sep 13, 2024 · 0 comments

Comments

@DelphiMan68
Copy link

Regards, 🌺

Some events of the TInjectTelegramBotManager component do not work. With the checks I did, I realized that the problem is in the TtdUpdate.&Type method in the TinjectTelegram.Types.Impl unit, where some events are not managed. To solve this problem, it is enough to replace the corresponding method with the following code:

function TtdUpdate.&Type: TtdUpdateType;
begin
  if CallbackQuery <> nil then
    Result := TtdUpdateType.CallbackQueryUpdate
  else if ChannelPost <> nil then
    Result := (TtdUpdateType.ChannelPost)
  else if ChosenInlineResult <> nil then
    Result := (TtdUpdateType.ChosenInlineResultUpdate)
  else if EditedChannelPost <> nil then
    Result := (TtdUpdateType.EditedChannelPost)
  else if EditedMessage <> nil then
    Result := (TtdUpdateType.EditedMessage)
  else if InlineQuery <> nil then
    Result := (TtdUpdateType.InlineQueryUpdate)
  else if Message <> nil then
    Result := (TtdUpdateType.MessageUpdate)
  else if PreCheckoutQuery <> nil then
    Result := (TtdUpdateType.PreCheckoutQueryUpdate)
  else if ShippingQuery <> nil then
    Result := (TtdUpdateType.ShippingQueryUpdate)
  else if MyChatMember <> nil then                      // --> Add
    Result := (TtdUpdateType.MyChatMember)
  else if ChatMember <> nil then                        // --> Add
    Result := (TtdUpdateType.ChatMember)
  else if PollState <> nil then                         // --> Add
    Result := (TtdUpdateType.PollState)
  else if PollAnswer <> nil then                        // --> Add
    Result := (TtdUpdateType.PollAnswer)
  else if ChatJoinRequest <> nil then                   // --> Add
    Result := (TtdUpdateType.ChatJoinRequest)
  else if ChatBoost <> nil then                         // --> Add
    Result := (TtdUpdateType.ChatBoost)
//else if RemovedChatBoost <> nil then                  // --> Add
//  Result := (TtdUpdateType.RemovedChatBoost)
  else if MessageReaction <> nil then                   // --> Add
    Result := (TtdUpdateType.MessageReaction)
  else if MessageReactionCount <> nil then              // --> Add
    Result := (TtdUpdateType.MessageReactionCount)
  else
    Result := TtdUpdateType.UnknownUpdate;
end;

Thnaks ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant