use of net.robinfriedli.aiode.command.widget.AbstractWidgetAction in project aiode by robinfriedli.
the class HistoryInterceptor method performChained.
@Override
public void performChained(Command command) {
CommandContext context = command.getContext();
CommandHistory history = new CommandHistory();
long currentTimeMillis = System.currentTimeMillis();
history.setStartMillis(currentTimeMillis);
history.setTimestamp(LocalDateTime.ofInstant(Instant.ofEpochMilli(currentTimeMillis), ZoneId.systemDefault()));
history.setCommandContextId(command.getContext().getId());
history.setCommandIdentifier(command.getIdentifier());
history.setWidget(command instanceof AbstractWidgetAction);
history.setCommandBody(command instanceof AbstractCommand ? ((AbstractCommand) command).getCommandInput() : command.getCommandBody());
history.setInput(command instanceof AbstractCommand ? context.getMessage().getContentDisplay() : command.getCommandBody());
history.setGuild(context.getGuild().getName());
history.setGuildId(context.getGuild().getId());
history.setUser(context.getUser().getName());
history.setUserId(context.getUser().getId());
context.setCommandHistory(history);
}
Aggregations