discord-jda / JDA

Java wrapper for the popular chat & VOIP service: Discord https://discord.com
Apache License 2.0
4.28k stars 737 forks source link

Slash Commands and Interactions #1470

Closed MinnDevelopment closed 3 years ago

MinnDevelopment commented 3 years ago

Discord has made the disappointing decision to rush out this feature to the API. Due to this decision, it is very unpolished and is missing a lot of the feedback that was provided by the early testers.

Since I'm very busy with my own projects for work and university, I have made the decision to not rush out a JDA implementation and instead actually polish it and finish it properly first. Unlike Discord, I care to provide a quality API.

I've compiled a small list of major issues that have not been addressed before releasing slash commands. Some of these things would now require breaking changes to the API so I have no hope for them to be addressed even in later patches.

I'm pretty happy with how much work they've been putting into improving the API for this stuff. But its still a bit unfinished. I'll elaborate further in the linked Pull Request.

What is still missing?

The feedback that made it in

What it will probably look like

public void onSlashCommand(SlashCommandEvent event) {
  if (event.getCommandName().equals("async")) {
    event.acknowledge(false) // log the original message, respond later (because you only have 3 seconds to respond)
      .delay(10, TimeUnit.MINUTES)
      .flatMap(commandThread -> command.sendMessage("asynchronous response")) // this can be done up to 15 minutes later
      .queue();
  } else if (event.getCommandName().equals("ping")) {
    event.reply("Pong!").setEphemeral(true).queue();
  }
}
MinnDevelopment commented 3 years ago

I'll be tracking future development in #1501