Slash Command purge [Answered]
Hi, I'm trying to use my old purge command as a slash command, but I end up giving me the Discord Error "Application Didn't Respond".
I've tried making the var message a RespondAsync but the code is not happy about that
Does anyone know how to solve this issue of mine?
14 Replies
can i see the full block of code?
like the function itself + its attributes?
So important note is that an interaction response does not return anything, but i'll show you how to get around that
one sec
Thanks a lot 😄
you can make the message itself ephemeral so that it automatically deletes itself
or doesn't show up basically
paste that into your code and see if that works
Wow thanks a lot didn't know that 🤯
Oh yeah now that you're here. Is there a smart way of making error messages if a user is trying to use a slash command they don't have the required role for?
i personally dont use the RequireRole attributes and that stuff, so I'm not sure if Discord.Net / DSharpPlus has something built in that you can overwrite
but how i do it is something like this
Ok thanks a lot
✅ This post has been marked as answered!
Just tried it but it can't find Roles in Context.Interaction.User.Roles.??
It says: 'SocketUser' does not contain a definition for 'Roles' and no accessible extension method 'Roles' accepting a first argument of type 'SocketUser' could be found (are you missing a using directive or an assembly reference?)
maybe try
var roles = (Context.Interaction.User as SocketGuildUser).Roles;
That works 🤩
Sweet 😎
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View