#Clickable Commands on PC - Help

1 messages · Page 1 of 1 (latest)

oak pecan
#

So I've been seeing clickable commands that will insert into the message box for a while now - not a big issue, I've done that and it worked fine on Mobile, however I've now seen a Bot being able to do that on the PC Client of Discord and i previously thought its a Mobile thing
for reference i have attached screenshots
The first screenshot is a message that MEE6 has sent, the second one is a message that i tried on my own bot
I'm "embedding" commands like this: <command-name:applicationId>

hidden hawk
#

</command:commandId>

#

gotta use id of the command, not application's one

oak pecan
#

ah

#

how would i get the commandId

#

i already made it so the commands are clickable on the help command on mobile it would be super useful if it worked on all clients so im gonna refactor it to use that approach

hidden hawk
#

DiscordSocketClient.GetGlobalApplicationCommandAsync()

#

or well

#

SocketGuild.Get......CommandsAsync()

#

for guild ones

oak pecan
#

thanks

#

can i then like

#

get the commands by name from that list?

#

for example

someCommandList["rewards-help"]

hidden hawk
#

by name, yah

oak pecan
#

thanks!

#

i appreciate it

hidden hawk
#

with linq probably

#

it returns a collection of commands

empty nacelle
#

not with index operator

hidden hawk
#

so .FirstOrDefault

empty nacelle
#

it also returns all command types

hidden hawk
#

and that

empty nacelle
#

message/user & slash

oak pecan
#

as long as i can get the commands by name, any way is alright

hidden hawk
#

gotta check that a command is a slash one

#
  • you only need top level ones, don't search for subcommands
oak pecan
#

ye

empty nacelle
#

cause technically the sub commands are parameters

#

cause, uhhh, discord

oak pecan
#

i didnt even know its called subcommands i always just called them arguments / parameters