diff --git a/src/main/java/xyz/vallat/louis/discord/DiscordManager.java b/src/main/java/xyz/vallat/louis/discord/DiscordManager.java index e686af8..90aa97a 100644 --- a/src/main/java/xyz/vallat/louis/discord/DiscordManager.java +++ b/src/main/java/xyz/vallat/louis/discord/DiscordManager.java @@ -49,7 +49,10 @@ public final class DiscordManager { discordClient.getEventDispatcher().on(MessageCreateEvent.class) .filter(event -> event.getMessage().getAuthor().map(user -> !user.isBot()).orElse(false)) .filter(event -> event.getMessage().getContent().split(" ")[0].equals(command.getName())) - .flatMap(event -> !isInMaintenanceMode() ? command.execute(event).then() : Mono.just("").then()) + .flatMap(event -> !isInMaintenanceMode() ? command.execute(event).then() : Mono.empty()) + .doOnError(e -> logger.warn("An error occurred while executing a command " + + "('" + command.getName() + "'):", e)) + .onErrorResume(e -> Mono.empty()) .subscribe(); }