Skip to content

Send slash commands (/something) #31

Answered by rigwild
minhla asked this question in Q&A
Discussion options

You must be logged in to vote

Updated the script with searchSlashCommand and sendSlashCommand! ☺️

Example to search for a command named /rank and run it (with the MEE6 bot):

{
  id()

  const guildId = gid
  const channelId = cid

  // Search a command named `rank`, pick the first result
  const searchRes = await api.searchSlashCommand(channelId, 'rank')
  const command = searchRes.application_commands[0]

  // Get my rank, no command options
  await api.sendSlashCommand(guildId, channelId, command)

  // Get the rank of someone, pass the user in command options
  await api.sendSlashCommand(guildId, channelId, command, [{ type: 6, name: 'member', value: '1234535821234567890' }])
}

Note: The command search may return m…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@minhla
Comment options

@minhla
Comment options

Answer selected by minhla
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants