discord-php / DiscordPHP

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

Modal freeze with multiple usage at the same time #1117

Closed DARL0K closed 1 year ago

DARL0K commented 1 year ago

Hi. I have trouble when couple of users at the same time using modals. For example this code:

$discord->listenCommand("testreg", function (Interaction $interaction) use ($discord) {
    $ar[] = ActionRow::new()->addComponent(TextInput::new("Test teest:",TextInput::STYLE_SHORT)->setMinLength(1));

    $interaction->showModal("test", "123123", $ar, function (Interaction $interaction, Collection $components) {
        $interaction->acknowledge();
    });
});

Explanation of the issue: User 1 wrote /testreg and filling the form. At the same time User 2 wrote /testreg and also started to fill the form. User 1 or User 2 will recieve "Something went wrong. Try again.". But only one of them, another will have successfull complete.

image

May be someone could clarify in which way I should think?

key2peace commented 1 year ago

The second arg of showModal is a custom_id, which should be unique per interaction