[AB-53] adding economy related commands

adding runtime exception to root command handling
adding simple custom command module
disabling slash command for show emote the utility is not given (the bot cannot show any emotes from servers its not in)
fixing post target setup not allowing threads
fixing post targets not supporting threads
fixing interactions not considering the actual amount of embeds
fixing some cases for events which are not in a guild
This commit is contained in:
Sheldan
2022-07-21 00:43:04 +02:00
parent 68cae74819
commit 9954515db0
81 changed files with 3717 additions and 108 deletions

View File

@@ -54,19 +54,6 @@ public class ShowEmote extends AbstractConditionableCommand {
.thenApply(aVoid -> CommandResult.fromIgnored());
}
@Override
public CompletableFuture<CommandResult> executeSlash(SlashCommandInteractionEvent event) {
String emoteText = slashCommandParameterService.getCommandOption(EMOTE_PARAMETER, event, Emote.class, String.class);
Emoji emoji = Emoji.fromMarkdown(emoteText);
Emote emote = event.getJDA().getEmoteById(emoji.getId());
ShowEmoteLog emoteLog = ShowEmoteLog
.builder()
.emote(emote)
.build();
return interactionService.replyEmbed(SHOW_EMOTE_RESPONSE_TEMPLATE, emoteLog, event)
.thenApply(interactionHook -> CommandResult.fromSuccess());
}
@Override
public CommandConfiguration getConfiguration() {
List<Parameter> parameters = new ArrayList<>();
@@ -82,16 +69,8 @@ public class ShowEmote extends AbstractConditionableCommand {
.templated(true)
.build();
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.rootCommandName(UtilitySlashCommandNames.UTILITY)
.commandName(SHOW_EMOTE_COMMAND)
.build();
return CommandConfiguration.builder()
.name(SHOW_EMOTE_COMMAND)
.slashCommandConfig(slashCommandConfig)
.module(UtilityModuleDefinition.UTILITY)
.templated(true)
.async(true)