Implement trivia welcome screen with category picker

This commit is contained in:
2022-12-21 17:59:25 +01:00
parent d4c3afbddd
commit 1c19f3c07f
13 changed files with 184 additions and 40 deletions

View File

@@ -0,0 +1,45 @@
package wtf.beatrice.hidekobot.objects.fun;
import wtf.beatrice.hidekobot.util.RandomUtil;
import java.util.UUID;
public class Dice
{
private final int sides;
private int value = 0;
private final UUID uuid;
public Dice(int sides)
{
this.sides = sides;
this.uuid = UUID.randomUUID();
}
public Dice(Dice old)
{
this.sides = old.sides;
this.value = old.value;
this.uuid = UUID.randomUUID();
}
public int getValue()
{
return value;
}
public int getSides()
{
return sides;
}
public void roll()
{
value = RandomUtil.getRandomNumber(1, sides);
}
public UUID getUUID()
{
return uuid;
}
}

View File

@@ -0,0 +1,5 @@
package wtf.beatrice.hidekobot.objects.fun;
public record TriviaCategory(String categoryName, int categoryId) {
}

View File

@@ -0,0 +1,8 @@
package wtf.beatrice.hidekobot.objects.fun;
import java.util.List;
public record TriviaQuestion(String question, String correctAnswer,
List<String> wrongAnswers) {
}

View File

@@ -0,0 +1,31 @@
package wtf.beatrice.hidekobot.objects.fun;
import net.dv8tion.jda.api.entities.User;
public class TriviaScore
{
private final User user;
private int score = 0;
public TriviaScore(User user)
{
this.user = user;
}
public void changeScore(int add)
{
score += add;
}
public int getScore() { return score; }
public User getUser() { return user; }
@Override
public String toString()
{
return "[" + user.getAsTag() + "," + score + "]";
}
}