Closed Insecure05 closed 2 months ago
I am wondering if you have any suggestions. I'm not new to PHP but new to React and Discord Bots. I admit I'm not an power user with PHP, just average.
$discord->on(Event::GUILD_MEMBER_UPDATE, function ($member, Discord $discord, $oldMember) {
echo GUILD_MEMBER_UPDATE . " action found.";
});
as in, drop the typecasting
I will try this when I get home.
I copied the code directly from the wiki page. Most of them have the typecasting in it.
This page.
https://discord-php.github.io/DiscordPHP/guide/events/guilds.html
I actually was able to try it now. I get the same error with the change.
$discord->on(Event::GUILD_MEMBER_UPDATE, function ($member, Discord $discord, $oldMember) {
echo GUILD_MEMBER_UPDATE . " action found.";
});
PHP Fatal error: Uncaught TypeError: {closure}(): Argument #1 ($member) must be of type Discord\Parts\Thread\Member, Discord\Parts\User\Member given, called in /home/insecure/discord/bot/vendor/evenement/evenement/src/EventEmitterTrait.php on line 143 and defined in /home/insecure/discord/bot/narcos.php:39
Stack trace:
can you try to get rid of all the Member typecasting in there?
Closed as fix was provided but no confirmation for 4 months
Environment
To Reproduce
-- I have made the section in question bold. I get this error.
I cannot figure out why. I have tried so many different options but this keeps getting me.