diff --git a/README.md b/README.md index 846a6db..7287b1e 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,11 @@ Slash commands installation/updates: https://github.com/discord/discord-api-docs/issues/4856 - Slash commands from botdarr operate the same except they are not the same case (i.e., all the commands have dashes in them) +To make Non-Slash commands work you need to go to Discord Developer section -> Applications -> Bot -> Enable Message Content Intent + +![](https://raw.githubusercontent.com/shayaantx/botdarr/development/images/discord-message-content-intent.png) +- Non-slash commands don't work anymore with botdarr unless you are running your bot in 75+ servers, see https://support-dev.discord.com/hc/en-us/articles/4404772028055 + ## Slack Bot Installation See https://github.com/shayaantx/botdarr/wiki/Install-Slack-Bot diff --git a/images/discord-message-content-intent.png b/images/discord-message-content-intent.png new file mode 100644 index 0000000..e35408e Binary files /dev/null and b/images/discord-message-content-intent.png differ diff --git a/src/main/java/com/botdarr/clients/discord/DiscordBootstrap.java b/src/main/java/com/botdarr/clients/discord/DiscordBootstrap.java index 4e37af0..f5d1b91 100644 --- a/src/main/java/com/botdarr/clients/discord/DiscordBootstrap.java +++ b/src/main/java/com/botdarr/clients/discord/DiscordBootstrap.java @@ -199,7 +199,7 @@ public CommandData convertCommandToCommandData(Command command) { description = description.substring(0, 97); description += "..."; } - CommandData commandData = new CommandData(command.getCommandText().replace(' ', '-'), description); + CommandData commandData = new CommandData(DiscordResponseBuilder.formatForSlashCommand(command.getCommandText()), description); command.getInput().forEach(input -> { // all input is required by default commandData.addOption(OptionType.STRING, input, input, true); diff --git a/src/main/java/com/botdarr/clients/discord/DiscordResponseBuilder.java b/src/main/java/com/botdarr/clients/discord/DiscordResponseBuilder.java index bfd8596..9f990ee 100644 --- a/src/main/java/com/botdarr/clients/discord/DiscordResponseBuilder.java +++ b/src/main/java/com/botdarr/clients/discord/DiscordResponseBuilder.java @@ -331,6 +331,10 @@ public DiscordResponse build(SuccessResponse successResponse) { return new DiscordResponse(createSuccessMessageEmbed(successResponse.getSuccessMessage())); } + public static String formatForSlashCommand(String command) { + return command.replace(' ', '-'); + } + private DiscordResponse getMovieResponse(RadarrMovie radarrMovie) { EmbedBuilder embedBuilder = new EmbedBuilder(); embedBuilder.setTitle(radarrMovie.getTitle()); @@ -363,8 +367,12 @@ private static MessageEmbed createMessageEmbed(String title, Color color, String private DiscordResponse getListOfCommands(List commands) { EmbedBuilder embedBuilder = new EmbedBuilder(); embedBuilder.setTitle("Commands"); + String commandPrefix = CommandContext.getConfig().getPrefix().replace(" ", "-"); for (Command com : commands) { - embedBuilder.addField(CommandContext.getConfig().getPrefix().replace(" ", "-") + com.getCommandUsage(), com.getDescription(), false); + // slash commands + embedBuilder.addField(commandPrefix.equals("/") ? + commandPrefix + formatForSlashCommand(com.getCommandText()) : + commandPrefix + com.getCommandUsage(), com.getDescription(), false); } return new DiscordResponse(embedBuilder.build()); } diff --git a/src/main/resources/version.txt b/src/main/resources/version.txt index 475e184..25c1b35 100644 --- a/src/main/resources/version.txt +++ b/src/main/resources/version.txt @@ -1 +1 @@ -5.6.2 \ No newline at end of file +5.6.3 \ No newline at end of file