kiafumi/src/main/java/moe/oko/Kiafumi/command/utility/InviteCommand.java

58 lines
1.9 KiB
Java

package moe.oko.Kiafumi.command.utility;
import moe.oko.Kiafumi.Kiafumi;
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.ZonedDateTime;
import java.util.ArrayList;
import java.util.List;
import static moe.oko.Kiafumi.util.LoggingManager.slashLog;
/**
* Helpful Invite Command
* @author Kay, oko
*/
public class InviteCommand extends CommandClass {
@Override
public boolean isEnabled() {
return true; //Always enabled
}
@Override
public String getName() {
return "Invite";
}
@Override
public void newCommand(String name, SlashCommandInteractionEvent e) {
if(e.getGuild() == null) { return; }
if ("invite".equals(name)) {
slashLog(e);
e.deferReply().queue();
EmbedBuilder eb = new EmbedBuilder()
.setColor(EmbedUI.INFO)
.setAuthor("Kiafumi", "https://oko.moe/kiafumi.htm", Kiafumi.JDA.getSelfUser().getAvatarUrl())
.setTitle("Invite me to your server!", Kiafumi.instance.config.assembleDefaultInvite())
.setDescription("Alternatively, you can host me yourself!")
.appendDescription("https://fem.mint.lgbt/oko/kiafumi")
.setFooter(EmbedUI.BRAND)
.setTimestamp(ZonedDateTime.now());
e.getHook().sendMessageEmbeds(eb.build()).queue();
}
}
@Override
public List<CommandInfo> getSlashCommandInfo() {
List<CommandInfo> cil = new ArrayList<>();
CommandInfo ci = new CommandInfo("invite", "Returns an invite for Kiafumi.", CommandType.COMMAND);
cil.add(ci);
return cil;
}
}