Add more methods

java-rewrite
Hammy 3 years ago
parent 10f0823efc
commit 2924a41646

@ -1,7 +1,9 @@
package me.goudham.service;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.Member;
public interface EmbedGenerator {
EmbedBuilder getBaseEmbed();
EmbedBuilder getUserEmbed(Member member);
}

@ -5,6 +5,7 @@ import java.awt.Color;
import java.time.Instant;
import java.util.Random;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.Member;
@Singleton
public class EnsoEmbedGenerator implements EmbedGenerator {
@ -12,11 +13,19 @@ public class EnsoEmbedGenerator implements EmbedGenerator {
@Override
public EmbedBuilder getBaseEmbed() {
Color randomColor = new Color(random.nextFloat(), random.nextFloat(), random.nextFloat());
return new EmbedBuilder()
.setColor(randomColor)
.setColor(getRandomColour())
.setTimestamp(Instant.now())
.setFooter("\uD835\uDCE4\uD835\uDD00\uD835\uDCE4");
}
@Override
public EmbedBuilder getUserEmbed(Member member) {
Color userColour = member.getColor() == null ? getRandomColour() : member.getColor();
return getBaseEmbed().setColor(userColour);
}
private Color getRandomColour() {
return new Color(random.nextFloat(), random.nextFloat(), random.nextFloat());
}
}

Loading…
Cancel
Save