HidekoBot/src/main/java/wtf/beatrice/hidekobot/commands/slash/InviteCommand.java
Beatrice Dellacà 3d626bb46f
All checks were successful
continuous-integration/drone/push Build is passing
Move command handling out of constructor, add coin reflip command
Having heavy code run in a constructor is bad practice. We made separate methods for command handling.
2022-11-20 22:09:58 +01:00

24 lines
781 B
Java

package wtf.beatrice.hidekobot.commands.slash;
import net.dv8tion.jda.api.entities.channel.ChannelType;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction;
import org.jetbrains.annotations.NotNull;
import wtf.beatrice.hidekobot.Configuration;
public class InviteCommand
{
public void runSlashCommand(@NotNull SlashCommandInteractionEvent event)
{
ReplyCallbackAction reply = event.reply("Here's your link ✨ " + Configuration.getInviteUrl());
// only make message permanent in DMs
if(!(event.getChannelType() == ChannelType.PRIVATE))
{
reply = reply.setEphemeral(true);
}
reply.queue();
}
}