61 lines
1.8 KiB
Java
61 lines
1.8 KiB
Java
package moe.oko.Kiafumi.command.fun;
|
|
|
|
import moe.oko.Kiafumi.command.CommandClass;
|
|
import moe.oko.Kiafumi.util.CommandInfo;
|
|
import moe.oko.Kiafumi.util.CommandType;
|
|
import moe.oko.Kiafumi.util.EmbedUI;
|
|
import net.dv8tion.jda.api.EmbedBuilder;
|
|
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
|
|
|
import java.time.LocalDate;
|
|
import java.time.Month;
|
|
import java.time.ZonedDateTime;
|
|
import java.time.temporal.ChronoUnit;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
import static moe.oko.Kiafumi.util.LoggingManager.slashLog;
|
|
|
|
/**
|
|
* Fetches the REAL date
|
|
* @author oko
|
|
*/
|
|
public class SeptemberDateCommand extends CommandClass {
|
|
|
|
@Override
|
|
public boolean isEnabled() { return true; }
|
|
|
|
@Override
|
|
public String getName() { return "SeptemberDate"; }
|
|
|
|
final LocalDate september = LocalDate.of(1993, Month.AUGUST, 31);
|
|
|
|
@Override
|
|
public void newCommand(String name, SlashCommandInteractionEvent e) {
|
|
if ("sdate".equals(name)) {
|
|
slashLog(e);
|
|
e.deferReply().queue();
|
|
|
|
var now = LocalDate.now();
|
|
|
|
// Create the Eternal September date
|
|
var sdate = ChronoUnit.DAYS.between(september, now);
|
|
|
|
var eb = new EmbedBuilder()
|
|
.setColor(EmbedUI.INFO)
|
|
.setTitle("sdate")
|
|
.setDescription("Today is September, " + sdate + " 1993, the september that never ends")
|
|
.setFooter(EmbedUI.BRAND)
|
|
.setTimestamp(ZonedDateTime.now());
|
|
e.getHook().sendMessageEmbeds(eb.build()).queue();
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public List<CommandInfo> getSlashCommandInfo() {
|
|
List<CommandInfo> cil = new ArrayList<>();
|
|
cil.add(new CommandInfo("sdate", "Returns the Eternal September date.", CommandType.COMMAND));
|
|
return cil;
|
|
}
|
|
}
|