SinisterRectus / Discordia

Discord API library written in Lua for the Luvit runtime environment
MIT License
712 stars 145 forks source link

[dev] Client:createInteractionResponse requires `payload.data`. Should be optional #301

Open GitSparTV opened 3 years ago

GitSparTV commented 3 years ago

https://github.com/SinisterRectus/Discordia/blob/dev/libs/client/CommandClient.lua#L232

With interactionResponseType.deferredChannelMessageWithSource (and probably deferredUpdateMessage) the payload.data is optional (it will be ignored).

Current implementation in Discordia doesn't allow this.

Fix:

-  local message, files = checkMessage(payload.data, self.defaultAllowedMentions)
+  local message, files = payload.data and checkMessage(payload.data, self.defaultAllowedMentions)
SinisterRectus commented 3 years ago

Thanks for the issue. I expect to fix this and related inconsistencies as I refactor much of the payload input checking/resolving. It's kind of a mess of functions and files right now. I'll keep this open as a reminder.