discordia-slash
discordia-slash copied to clipboard
interactionCreate is not guaranteed to be handled first by the library
https://github.com/GitSparTV/discordia-slash/blob/master/libs/client/Client.lua#L268-L303
if the user defines a interactionCreate before the use of Client:useApplicationCommands, their event listener will run first, possibly interfering with the library's code.
The solution to this would be using a pre-listener offer by discordia-interactions, like this:
function discordia_interactions.EventHandler.interaction_create_prelisteners.slashCommands(intr, client)
if intr.type == enums.interactionType.applicationCommand and intr.data.type == 1 then
client:emit('slashCommand', intr)
end
end
This also means that the user doesn't even need to do Client:useApplicationCommands to begin with if this is used, you just hook into discordia-interactions which handles it for you.