mirror of
https://github.com/Sheldan/Sissi.git
synced 2026-01-26 11:21:21 +00:00
[SIS-xxx] adding logging to see which quote is sent in the case of random quotes
This commit is contained in:
@@ -23,6 +23,7 @@ import dev.sheldan.sissi.module.quotes.config.QuotesModuleDefinition;
|
|||||||
import dev.sheldan.sissi.module.quotes.exception.QuoteNotFoundException;
|
import dev.sheldan.sissi.module.quotes.exception.QuoteNotFoundException;
|
||||||
import dev.sheldan.sissi.module.quotes.model.database.Quote;
|
import dev.sheldan.sissi.module.quotes.model.database.Quote;
|
||||||
import dev.sheldan.sissi.module.quotes.service.QuoteServiceBean;
|
import dev.sheldan.sissi.module.quotes.service.QuoteServiceBean;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||||
@@ -37,6 +38,7 @@ import java.util.Optional;
|
|||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
@Slf4j
|
||||||
public class QuoteCommand extends AbstractConditionableCommand {
|
public class QuoteCommand extends AbstractConditionableCommand {
|
||||||
|
|
||||||
private static final String QUOTE_COMMAND = "quote";
|
private static final String QUOTE_COMMAND = "quote";
|
||||||
@@ -76,6 +78,7 @@ public class QuoteCommand extends AbstractConditionableCommand {
|
|||||||
foundQuote = quoteServiceBean.getRandomQuoteForMember(user);
|
foundQuote = quoteServiceBean.getRandomQuoteForMember(user);
|
||||||
}
|
}
|
||||||
Quote quoteToDisplay = foundQuote.orElseThrow(QuoteNotFoundException::new);
|
Quote quoteToDisplay = foundQuote.orElseThrow(QuoteNotFoundException::new);
|
||||||
|
log.info("Displaying quote {} in server {}.", quoteToDisplay.getId(), quoteToDisplay.getServer().getId());
|
||||||
return quoteServiceBean.renderQuoteToMessageToSend(quoteToDisplay)
|
return quoteServiceBean.renderQuoteToMessageToSend(quoteToDisplay)
|
||||||
.thenCompose(messageToSend -> self.sendMessageToChannel(messageToSend, commandContext.getChannel()))
|
.thenCompose(messageToSend -> self.sendMessageToChannel(messageToSend, commandContext.getChannel()))
|
||||||
.thenApply(unused -> CommandResult.fromSuccess());
|
.thenApply(unused -> CommandResult.fromSuccess());
|
||||||
@@ -98,6 +101,7 @@ public class QuoteCommand extends AbstractConditionableCommand {
|
|||||||
foundQuote = quoteServiceBean.getRandomQuote(server);
|
foundQuote = quoteServiceBean.getRandomQuote(server);
|
||||||
}
|
}
|
||||||
Quote quoteToDisplay = foundQuote.orElseThrow(QuoteNotFoundException::new);
|
Quote quoteToDisplay = foundQuote.orElseThrow(QuoteNotFoundException::new);
|
||||||
|
log.info("Displaying quote {} in server {}.", quoteToDisplay.getId(), quoteToDisplay.getServer().getId());
|
||||||
return quoteServiceBean.renderQuoteToMessageToSend(quoteToDisplay)
|
return quoteServiceBean.renderQuoteToMessageToSend(quoteToDisplay)
|
||||||
.thenCompose(messageToSend -> self.replyMessage(event, messageToSend))
|
.thenCompose(messageToSend -> self.replyMessage(event, messageToSend))
|
||||||
.thenApply(unused -> CommandResult.fromSuccess());
|
.thenApply(unused -> CommandResult.fromSuccess());
|
||||||
|
|||||||
Reference in New Issue
Block a user