✅ Discord Modal submits but keep pending?
Hi, I've made a Modal on my Discord Bot running on .Net 6 and it work as intended but for some reason it sends the message and keeps having a pending message, like it's trying to send what already got send the modal:
Sending the modal:
13 Replies
It looks like you're doing a .DeferLoadingAsync or DeferAsync on some component in the chain, probably the one where they send the command. You'll need to do a .FollowupAsync on whatever was deferred
Or that RespondWithModalAsync is doing it automatically. Most likely you want to send the response as a .Followup on the original command message, not a response to the modal
I'm not entirely sure how to do the follow up part...
Something like this?
it can get complicated. The modal reference in ModalSubmitted might have a link to its parent interaction for you to FollowUp on
But I'd mostly suggest scouring the modal docs if you haven't already, find some examples, because this doesn't seem like a thing that should be happening
I followed this guide
https://discordnet.dev/guides/int_basics/modals/intro.html
Discord.Net Docs
Getting Started with Modals | Discord.Net Documentation
This guide will show you how to use modals and give a few examples of
valid use cases.
dealing with the followups usually only happens if you intentionally deferred something, then you have to keep some reference to the thing you deferred so you can follow it up
Hm. Well. Actually now that I look at it, a deferred one I think usually shows something like "Loading..." not 'sending command'.
Discord seems to think the bot didn't respond to or accept the slash command. The code you posted looks right to me, maybe double-check the setup stuff
Discord seems to think the bot didn't respond to or accept the slash command. The code you posted looks right to me, maybe double-check the setup stuff
You mean the setup of my bot?
Yeah, the parts that register the slash command handlers and whatnot. Without seeing code I can only guess, but maybe your slash command handler is using a different instance of the client?
looking through one of my old bots, this set of commands in particular might be relevant...? Not sure
It seems like your bot is, clearly, getting the messages, but not acknowledging the slash commands (but it might be acknowledging the modal). Since it responds to the modal but not to the original slash command, it still kinda seems like whichever _client you put the .ModalSubmitted on, might not be the same client that is handling the slash commands, or something about its context isn't registered right and gets lost
You think it's because my _client.InteractionCreated is connected with HandleInteraction instead?
Whatever's in HandleInteraction might not be doing the right thing
it should probably look exactly like the code I have above, that's standard stuff to connect up the context
Yeah mine is just a bit different 😅
Let me try your code and see if it fixes the issue it works, hopefully none of my other things are going to break with this new setup 😅
If it does it will be a problem for the future 😉
Thanks a lot for the help
Closed!