Skip to content

Commit

Permalink
Fix discord help messages to actually reflect actual commands (regard…
Browse files Browse the repository at this point in the history
…less if slash or non slash commands are used) + update readme for slash vs non slash command usage + update version (#94)
  • Loading branch information
shayaantx authored Mar 21, 2023
1 parent d9348b5 commit 35229c9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file added images/discord-message-content-intent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -363,8 +367,12 @@ private static MessageEmbed createMessageEmbed(String title, Color color, String
private DiscordResponse getListOfCommands(List<Command> 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());
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.6.2
5.6.3

0 comments on commit 35229c9

Please sign in to comment.