use of net.dv8tion.jda.api.interactions.commands.OptionMapping in project Ree6 by Ree6-Applications.
the class Slap method onPerform.
@Override
public void onPerform(CommandEvent commandEvent) {
if (commandEvent.isSlashCommand()) {
OptionMapping targetOption = commandEvent.getSlashCommandInteractionEvent().getOption("target");
if (targetOption != null && targetOption.getAsMember() != null) {
sendSlap(targetOption.getAsMember(), commandEvent);
} else {
sendMessage("No User was given to Slap!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
}
} else {
if (commandEvent.getArguments().length == 1) {
if (commandEvent.getMessage().getMentionedMembers().isEmpty()) {
sendMessage("No User mentioned!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "slap @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
} else {
sendSlap(commandEvent.getMessage().getMentionedMembers().get(0), commandEvent);
}
} else {
sendMessage("Not enough Arguments!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "slap @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
}
}
}
use of net.dv8tion.jda.api.interactions.commands.OptionMapping in project Ree6 by Ree6-Applications.
the class Hug method onPerform.
@Override
public void onPerform(CommandEvent commandEvent) {
if (commandEvent.isSlashCommand()) {
OptionMapping targetOption = commandEvent.getSlashCommandInteractionEvent().getOption("target");
if (targetOption != null && targetOption.getAsMember() != null) {
sendHug(targetOption.getAsMember(), commandEvent);
} else {
sendMessage("No User was given to Hug!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
}
} else {
if (commandEvent.getArguments().length == 1) {
if (commandEvent.getMessage().getMentionedMembers().isEmpty()) {
sendMessage("No User mentioned!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "hug @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
} else {
sendHug(commandEvent.getMessage().getMentionedMembers().get(0), commandEvent);
}
} else {
sendMessage("Not enough Arguments!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "hug @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
}
}
}
use of net.dv8tion.jda.api.interactions.commands.OptionMapping in project Ree6 by Ree6-Applications.
the class Ban method onPerform.
@Override
public void onPerform(CommandEvent commandEvent) {
if (commandEvent.getMember().hasPermission(Permission.ADMINISTRATOR)) {
if (commandEvent.isSlashCommand()) {
OptionMapping targetOption = commandEvent.getSlashCommandInteractionEvent().getOption("target");
OptionMapping reasonOption = commandEvent.getSlashCommandInteractionEvent().getOption("reason");
if (targetOption != null) {
if (reasonOption != null) {
banMember(targetOption.getAsMember(), reasonOption.getAsString(), commandEvent);
} else {
banMember(targetOption.getAsMember(), null, commandEvent);
}
} else {
sendMessage("No User was given to Ban!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
}
} else {
if (commandEvent.getArguments().length > 0) {
if (commandEvent.getMessage().getMentionedMembers().isEmpty()) {
sendMessage("No User mentioned!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "ban @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
} else {
if (commandEvent.getArguments().length == 1) {
banMember(commandEvent.getMessage().getMentionedMembers().get(0), null, commandEvent);
} else {
StringBuilder reason = new StringBuilder();
for (int i = 1; i < commandEvent.getArguments().length; i++) {
reason.append(commandEvent.getArguments()[i]).append(" ");
}
banMember(commandEvent.getMessage().getMentionedMembers().get(0), reason.toString(), commandEvent);
}
}
} else {
sendMessage("Not enough Arguments!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "ban @user [reason]", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
}
}
} else {
sendMessage("You don't have the Permission for this Command!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
}
deleteMessage(commandEvent.getMessage(), commandEvent.getInteractionHook());
}
use of net.dv8tion.jda.api.interactions.commands.OptionMapping in project Ree6 by Ree6-Applications.
the class Clear method onPerform.
@Override
public void onPerform(CommandEvent commandEvent) {
if (commandEvent.getMember().hasPermission(Permission.ADMINISTRATOR)) {
if (commandEvent.isSlashCommand()) {
OptionMapping amountOption = commandEvent.getSlashCommandInteractionEvent().getOption("amount");
if (amountOption != null) {
deleteMessages(commandEvent, (int) amountOption.getAsDouble());
}
} else {
if (commandEvent.getArguments().length == 1) {
try {
int amount = Integer.parseInt(commandEvent.getArguments()[0]);
if (amount <= 100 && amount >= 2) {
deleteMessages(commandEvent, amount);
} else {
sendMessage(commandEvent.getArguments()[0] + " isn't between 2 and 100 !", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "clear 2-100", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
}
} catch (Exception ex) {
sendMessage(commandEvent.getArguments()[0] + " isn't a number!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "clear 2-100", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
}
} else {
sendMessage("Not enough Arguments!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "clear 2-100", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
}
}
} else {
sendMessage("You don't have the Permission for this Command!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
}
}
use of net.dv8tion.jda.api.interactions.commands.OptionMapping in project Ree6 by Ree6-Applications.
the class Twitter method onPerform.
@Override
public void onPerform(CommandEvent commandEvent) {
if (commandEvent.isSlashCommand()) {
OptionMapping targetOption = commandEvent.getSlashCommandInteractionEvent().getOption("target");
OptionMapping contentOption = commandEvent.getSlashCommandInteractionEvent().getOption("content");
if (targetOption != null && contentOption != null) {
sendTwitterTweet(targetOption.getAsMember(), contentOption.getAsString(), commandEvent);
} else {
if (targetOption == null)
sendMessage("No User was given to use for the Tweet!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
if (contentOption == null)
sendMessage("No Tweet Content was given!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
}
} else {
if (commandEvent.getArguments().length >= 2) {
if (commandEvent.getMessage().getMentionedMembers().isEmpty()) {
sendMessage("No User given!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
} else {
StringBuilder stringBuilder = new StringBuilder();
for (int i = 1; i < commandEvent.getArguments().length; i++) {
stringBuilder.append(commandEvent.getArguments()[i]).append(" ");
}
sendTwitterTweet(commandEvent.getMessage().getMentionedMembers().get(0), stringBuilder.toString(), commandEvent);
}
} else {
sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitter @User Yourtexthere", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
}
}
}
Aggregations