Skip to content

Commit 842e0b4

Browse files
committed
properly logging subcommands in metrics
1 parent bb7164a commit 842e0b4

File tree

1 file changed

+5
-3
lines changed
  • application/src/main/java/org/togetherjava/tjbot/features/system

1 file changed

+5
-3
lines changed

application/src/main/java/org/togetherjava/tjbot/features/system/BotCore.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,14 +382,16 @@ public void onSlashCommandInteraction(SlashCommandInteractionEvent event) {
382382
logger.debug("Received slash command '{}' (#{}) on guild '{}'", name, event.getId(),
383383
event.getGuild());
384384
COMMAND_SERVICE.execute(() -> {
385-
386385
SlashCommand interactor = requireUserInteractor(
387386
UserInteractionType.SLASH_COMMAND.getPrefixedName(name), SlashCommand.class);
388387

389-
metrics.count("slash-" + name);
388+
String eventName = "slash-" + name;
389+
if (event.getSubcommandName() != null) {
390+
eventName += "_" + event.getSubcommandName();
391+
}
392+
metrics.count(eventName);
390393

391394
interactor.onSlashCommand(event);
392-
393395
});
394396
}
395397

0 commit comments

Comments
 (0)