discord-php / DiscordPHP

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

Modal Popups Interaction #984

Closed iZeaoGamer closed 1 year ago

iZeaoGamer commented 1 year ago

So I've practically fixed all of my previous issues, but there's one that I am unsure about.

How do you respond to an Modal Interaction? Because I tried things like acknowledgeWithResponse(), and respondWithMessage() after using showModal(), but doesn't work.

$interaction->showModal("Suggestion", "content", $builder->getComponents(), function (Interaction $interaction2, Collection $components) use ($discord, $interaction) {
                    /** @var RequestComponent $component */
                    foreach ($components->toArray() as $component) {
                        $content = $component->value;
                        $guild = $discord->guilds->get("id", $interaction2->guild_id);
                        if ($guild === null) {
                            return;
                        }

                        $interaction2->respondWithMessage(MessageBuilder::new()->setContent("You have submitted the suggestion for review!"), true);

When it tries to respond, it just appears with Horizon Utilities is thinking... on discord, and doesn't appear with the Responded message.

I hope you can help me with this issue. Thank you.

I'm using Discord-php v7 right now (The latest stable release).