Closed jocafamaka closed 1 year ago
Environment
Describe the bug Watching messages edits in MESSAGE_UPDATE event may lead the project to crash when the message is the original message of a thread.
MESSAGE_UPDATE
To Reproduce Steps to reproduce the behavior:
$discord->on(Event::MESSAGE_UPDATE, function (Message $message, Discord $discord) { print_r(["EDIT ", $message]); // Same effect with $message->__debugInfo(); });
Expected behavior Not to crash :)
Exception stack
PHP Warning: Uncaught TypeError: Discord\Factory\Factory::part(): Argument #2 ($data) must be of type array, stdClass given, called in path/vendor/team-reflex/discord-php/src/Discord/Parts/Channel/Message.php on line 438 and defined in path/vendor/team-reflex/discord-php/src/Discord/Factory/Factory.php:78 Stack trace: #0 path/vendor/team-reflex/discord-php/src/Discord/Parts/Channel/Message.php(438): Discord\Factory\Factory->part() #1 path/vendor/team-reflex/discord-php/src/Discord/Parts/Part.php(211): Discord\Parts\Channel\Message->getThreadAttribute() #2 path/vendor/team-reflex/discord-php/src/Discord/Parts/Part.php(360): Discord\Parts\Part->getAttribute() #3 path/vendor/team-reflex/discord-php/src/Discord/Parts/Part.php(466): Discord\Parts\Part->getPublicAttributes() #4 [internal function]: Discord\Parts\Part->__debugInfo() #5 path/bot.php(1155): print_r() #6 path/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(123): {closure}() #7 path/vendor/team-reflex/discord-php/src/Discord/Discord.php(774): Discord\Discord->emit() #8 path/vendor/react/promise/src/FulfilledPromise.php(42): Discord\Discord->Discord\{closure}() #9 path/vendor/react/promise/src/Promise.php(66): React\Promise\FulfilledPromise->done() #10 path/vendor/react/promise/src/Promise.php(168): React\Promise\Promise::React\Promise\{closure}() #11 path/vendor/react/promise/src/Promise.php(231): React\Promise\Promise->settle() #12 path/vendor/react/promise/src/Deferred.php(36): React\Promise\Promise::React\Promise\{closure}() #13 path/vendor/react/promise/src/FulfilledPromise.php(42): React\Promise\Deferred->resolve() #14 path/vendor/react/promise/src/Promise.php(61): React\Promise\FulfilledPromise->done() #15 path/vendor/team-reflex/discord-php/src/Discord/Discord.php(807): React\Promise\Promise->done() #16 path/vendor/team-reflex/discord-php/src/Discord/Discord.php(666): Discord\Discord->handleDispatch() #17 path/vendor/team-reflex/discord-php/src/Discord/Discord.php(632): Discord\Discord->processWsMessage() #18 path/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(123): Discord\Discord->handleWsMessage() #19 path/vendor/ratchet/pawl/src/WebSocket.php(72): Ratchet\Client\WebSocket->emit() #20 path/vendor/ratchet/rfc6455/src/Messaging/MessageBuffer.php(248): Ratchet\Client\WebSocket->Ratchet\Client\{closure}() #21 path/vendor/ratchet/rfc6455/src/Messaging/MessageBuffer.php(194): Ratchet\RFC6455\Messaging\MessageBuffer->processData() #22 path/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(123): Ratchet\RFC6455\Messaging\MessageBuffer->onData() #23 path/vendor/react/stream/src/Util.php(71): Evenement\EventEmitter->emit() #24 path/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(123): React\Stream\Util::React\Stream\{closure}() #25 path/vendor/react/stream/src/DuplexResourceStream.php(196): Evenement\EventEmitter->emit() #26 path/vendor/react/event-loop/src/ExtUvLoop.php(310): React\Stream\DuplexResourceStream->handleData() #27 [internal function]: React\EventLoop\ExtUvLoop->React\EventLoop\{closure}() #28 path/vendor/react/event-loop/src/ExtUvLoop.php(232): uv_run() #29 path/vendor/team-reflex/discord-php/src/Discord/Discord.php(1478): React\EventLoop\ExtUvLoop->run() #30 path/bot.php(3400): Discord\Discord->run() #31 {main} thrown in path/vendor/team-reflex/discord-php/src/Discord/Factory/Factory.php on line 78 PHP Fatal error: __debuginfo() must return an array in path/bot.php on line 1155
Environment
Describe the bug Watching messages edits in
MESSAGE_UPDATE
event may lead the project to crash when the message is the original message of a thread.To Reproduce Steps to reproduce the behavior:
Expected behavior Not to crash :)
Exception stack