move util to service
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/promote/production Build is passing

This commit is contained in:
2025-09-05 01:35:15 +02:00
parent f80a49995b
commit 29f486566b
7 changed files with 29 additions and 29 deletions

View File

@@ -14,7 +14,7 @@ import wtf.beatrice.hidekobot.objects.fun.TriviaCategory;
import wtf.beatrice.hidekobot.objects.fun.TriviaQuestion;
import wtf.beatrice.hidekobot.objects.fun.TriviaScore;
import wtf.beatrice.hidekobot.services.DatabaseService;
import wtf.beatrice.hidekobot.util.CommandUtil;
import wtf.beatrice.hidekobot.services.CommandService;
import java.util.*;
import java.util.concurrent.ScheduledFuture;
@@ -23,7 +23,7 @@ public class TriviaTask implements Runnable
{
private final DatabaseService databaseService;
private final CommandUtil commandUtil;
private final CommandService commandService;
private final User author;
private final MessageChannel channel;
@@ -42,13 +42,13 @@ public class TriviaTask implements Runnable
MessageChannel channel,
TriviaCategory category,
DatabaseService databaseService,
CommandUtil commandUtil)
CommandService commandService)
{
this.author = author;
this.channel = channel;
this.category = category;
this.databaseService = databaseService;
this.commandUtil = commandUtil;
this.commandService = commandService;
triviaJson = Trivia.fetchJson(Trivia.getTriviaLink(category.categoryId()));
questions = Trivia.parseQuestions(triviaJson); //todo: null check, rate limiting...
@@ -66,7 +66,7 @@ public class TriviaTask implements Runnable
if (previousMessage != null)
{
// todo: we shouldn't use this method, since it messes with the database... look at coin reflip
commandUtil.disableExpired(previousMessage.getId());
commandService.disableExpired(previousMessage.getId());
String previousCorrectAnswer = questions.get(iteration - 1).correctAnswer();