Add EnsoEmbedGenerator.java to generate embeds with minimal code duplication

java-rewrite
Hammy 3 years ago
parent a21dd25ee4
commit e3f0d39f5b

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

@ -0,0 +1,22 @@
package me.goudham.service;
import jakarta.inject.Singleton;
import java.awt.Color;
import java.time.Instant;
import java.util.Random;
import net.dv8tion.jda.api.EmbedBuilder;
@Singleton
public class EnsoEmbedGenerator implements EmbedGenerator {
private final Random random = new Random();
@Override
public EmbedBuilder getBaseEmbed() {
Color randomColor = new Color(random.nextFloat(), random.nextFloat(), random.nextFloat());
return new EmbedBuilder()
.setColor(randomColor)
.setTimestamp(Instant.now())
.setFooter("\uD835\uDCE4\uD835\uDD00\uD835\uDCE4");
}
}
Loading…
Cancel
Save