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?
![rooCry](https://cdn.discordapp.com/emojis/1025862925115736204.png)
14 Replies
can i see the full block of code?
like the function itself + its attributes?
![](https://utfs.io/f/2fc8eb7b-6389-42ae-9f31-39a645b437fa-4pl4mu.png)
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 ![rooHappy](https://cdn.discordapp.com/emojis/1025740807841517619.png)
![rooHappy](https://cdn.discordapp.com/emojis/1025740807841517619.png)
β
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β’2y ago
Message Not Public
Sign In & Join Server To View