discord-php / DiscordPHP

An API to interact with the popular messaging app Discord
MIT License
985 stars 236 forks source link

Submitting modal crashing bot. #966

Closed cemalct closed 1 year ago

cemalct commented 1 year ago

https://hastebin.com/ziwedefoto.php

`PHP Fatal error: Uncaught TypeError: Argument 2 passed to {closure}() must be an instance of Collection, instance of Discord\Helpers\Collection given, called in C:\discordBot\vendor\team-reflex\discord-php\src\Discord\Parts\Interactions\Interaction.php on line 583 and defined in C:\discordBot\bot.php:113 Stack trace:

0 C:\discordBot\vendor\team-reflex\discord-php\src\Discord\Parts\Interactions\Interaction.php(583): {closure}(Object(Discord\Parts\Interactions\Interaction), Object(Discord\Helpers\Collection))

1 C:\discordBot\vendor\evenement\evenement\src\Evenement\EventEmitterTrait.php(131): Discord\Parts\Interactions\Interaction->Discord\Parts\Interactions{closure}(Object(Discord\Parts\Interactions\Interaction), Object(Discord\Discord), NULL)

2 C:\discordBot\vendor\team-reflex\discord-php\src\Discord\Discord.php(755): Discord\Discord->emit('INTERACTION_CRE...', Array)

3 C:\discordBot\vendor\react\promise\src\FulfilledPromise.php(42): Discord\Discord->Discord{closure}(Object(Disc in C:\discordBot\bot.php on line 113`

cemalct commented 1 year ago

I thought it was related with submit button (that lib trying to recreate another modal after interacting with submit) but it seems related with Components. Removed, works fine. What does components stand for?

Solved, forgot to import Collection.