Closed guanzhihua168 closed 1 year ago
My solution is on line 144, add 'my_chat_member' => $this->myChatMember
It seems like you have Hyperf Collection which is causing this conflict. Remove that and it should work.
You're right, there is a conflict, but Hyperf's built-in can't remove it
PHP version
8.2
irazasyed/telegram-bot-sdk version
v3.13.0
Laravel version (if any)
No response
Code To Reproduce the bug
$manager = new BotsManager($config); try { $telegram = $manager->bot('mybot'); $update = $telegram->commandsHandler(); var_dump($update);
Error stacktrace (if any)
string(7) "message" string(7) "message" string(7) "message" string(14) "my_chat_member" vendor/irazasyed/telegram-bot-sdk/src/Objects/Update.php:133. Above output [var_dump($this->detectType())],Throws an exception while printing my chat member
Telegram\Bot\Objects\Update::getMessage(): Return value must be of type Illuminate\Support\Collection, Hyperf\Collection\Collection returned [ERROR] TypeError: Telegram\Bot\Objects\Update::getMessage(): Return value must be of type Illuminate\Support\Collection, Hyperf\Collection\Collection returned in /data/tgbot/vendor/irazasyed/telegram-bot-sdk/src/Objects/Update.php:145 Stack trace:
0 /data/tgbot/vendor/irazasyed/telegram-bot-sdk/src/Objects/Update.php(107): Telegram\Bot\Objects\Update->getMessage()
1 /data/tgbot/vendor/irazasyed/telegram-bot-sdk/src/Methods/Update.php(212): Telegram\Bot\Objects\Update->objectType()
2 /data/tgbot/vendor/irazasyed/telegram-bot-sdk/src/Methods/Update.php(57): Telegram\Bot\Api->dispatchUpdateEvent()
3 [internal function]: Telegram\Bot\Api->Telegram\Bot\Methods{closure}()
4 /data/tgbot/vendor/hyperf/collection/src/Collection.php(877): array_map()
5 /data/tgbot/vendor/irazasyed/telegram-bot-sdk/src/Methods/Update.php(53): Hyperf\Collection\Collection->map()
6 /data/tgbot/vendor/irazasyed/telegram-bot-sdk/src/Traits/CommandsHandler.php(60): Telegram\Bot\Api->getUpdates()
7 /data/tgbot/vendor/irazasyed/telegram-bot-sdk/src/Traits/CommandsHandler.php(37): Telegram\Bot\Api->useGetUpdates()
8 /data/tgbot/app/Command/TgBotCommand.php(43): Telegram\Bot\Api->commandsHandler()
9 /data/tgbot/vendor/hyperf/command/src/Command.php(428): App\Command\TgBotCommand->handle()
10 [internal function]: Hyperf\Command\Command->Hyperf\Command{closure}()
11 {main}