use of net.dv8tion.jda.api.interactions.commands.OptionMapping in project Ree6 by Ree6-Applications.
the class Mute method onPerform.
@Override
public void onPerform(CommandEvent commandEvent) {
if (commandEvent.getMember().hasPermission(Permission.ADMINISTRATOR)) {
if (!Main.getInstance().getSqlConnector().getSqlWorker().isMuteSetup(commandEvent.getGuild().getId())) {
sendMessage("Mute Role hasn't been set!\nTo set it up type " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "setup mute @MuteRole !", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
return;
}
if (commandEvent.isSlashCommand()) {
OptionMapping targetOption = commandEvent.getSlashCommandInteractionEvent().getOption("target");
if (targetOption != null) {
muteMember(targetOption.getAsMember(), commandEvent);
} else {
sendMessage("No User was given to Mute!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
}
} else {
if (commandEvent.getArguments().length == 1) {
if (commandEvent.getMessage().getMentionedUsers().isEmpty()) {
sendMessage("No User mentioned!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "mute @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
} else {
muteMember(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() + "mute @user", 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 Volume method onPerform.
@Override
public void onPerform(CommandEvent commandEvent) {
if (!Main.getInstance().getMusicWorker().isConnected(commandEvent.getGuild())) {
sendMessage("Im not connected to any Channel, so there is nothing to set the volume for!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
}
if (!Main.getInstance().getMusicWorker().checkInteractPermission(commandEvent)) {
return;
}
EmbedBuilder em = new EmbedBuilder();
if (commandEvent.isSlashCommand()) {
OptionMapping volumeOption = commandEvent.getSlashCommandInteractionEvent().getOption("amount");
if (volumeOption != null) {
int volume = (int) volumeOption.getAsDouble();
Main.getInstance().getMusicWorker().getGuildAudioPlayer(commandEvent.getGuild()).player.setVolume(volume);
em.setAuthor(BotInfo.botInstance.getSelfUser().getName(), Data.WEBSITE, BotInfo.botInstance.getSelfUser().getAvatarUrl());
em.setTitle("Music Player!");
em.setThumbnail(BotInfo.botInstance.getSelfUser().getAvatarUrl());
em.setColor(Color.GREEN);
em.setDescription("The Volume has been set to " + volume);
} else {
em.setAuthor(BotInfo.botInstance.getSelfUser().getName(), Data.WEBSITE, BotInfo.botInstance.getSelfUser().getAvatarUrl());
em.setTitle("Music Player!");
em.setThumbnail(BotInfo.botInstance.getSelfUser().getAvatarUrl());
em.setColor(Color.RED);
em.setDescription("No Volume was given.");
}
} else {
if (commandEvent.getArguments().length == 1) {
int vol;
try {
vol = Integer.parseInt(commandEvent.getArguments()[0]);
} catch (Exception e) {
vol = 50;
}
Main.getInstance().getMusicWorker().getGuildAudioPlayer(commandEvent.getGuild()).player.setVolume(vol);
em.setAuthor(BotInfo.botInstance.getSelfUser().getName(), Data.WEBSITE, BotInfo.botInstance.getSelfUser().getAvatarUrl());
em.setTitle("Music Player!");
em.setThumbnail(BotInfo.botInstance.getSelfUser().getAvatarUrl());
em.setColor(Color.GREEN);
em.setDescription("The Volume has been set to " + vol);
} else {
em.setAuthor(BotInfo.botInstance.getSelfUser().getName(), Data.WEBSITE, BotInfo.botInstance.getSelfUser().getAvatarUrl());
em.setTitle("Music Player!");
em.setThumbnail(BotInfo.botInstance.getSelfUser().getAvatarUrl());
em.setColor(Color.GREEN);
em.setDescription("Type " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "volume [voulume]");
}
}
em.setFooter(commandEvent.getGuild().getName() + " - " + Data.ADVERTISEMENT, commandEvent.getGuild().getIconUrl());
sendMessage(em, 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
}
use of net.dv8tion.jda.api.interactions.commands.OptionMapping in project Ree6 by Ree6-Applications.
the class Kick method onPerform.
@Override
public void onPerform(CommandEvent commandEvent) {
if (commandEvent.getMember().hasPermission(Permission.ADMINISTRATOR)) {
if (commandEvent.isSlashCommand()) {
OptionMapping targetOption = commandEvent.getSlashCommandInteractionEvent().getOption("target");
if (targetOption != null) {
kickMember(targetOption.getAsMember(), commandEvent);
} else {
sendMessage("No User was given to Kick!", 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() + "kick @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
} else {
kickMember(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() + "kick @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
}
}
} else {
sendMessage("You dont 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 Prefix method onPerform.
@Override
public void onPerform(CommandEvent commandEvent) {
if (commandEvent.getMember().hasPermission(Permission.ADMINISTRATOR) && commandEvent.getMember().hasPermission(Permission.MANAGE_SERVER)) {
if (commandEvent.isSlashCommand()) {
OptionMapping prefixOption = commandEvent.getSlashCommandInteractionEvent().getOption("new-prefix");
if (prefixOption != null) {
Main.getInstance().getSqlConnector().getSqlWorker().setSetting(commandEvent.getGuild().getId(), "chatprefix", prefixOption.getAsString());
sendMessage("Your new Prefix has been set to: " + prefixOption.getAsString(), 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
} else {
sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "prefix PREFIX", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
}
} else {
if (commandEvent.getArguments().length != 1) {
sendMessage((commandEvent.getArguments().length < 1 ? "Not enough" : "Too many") + " Arguments!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "prefix PREFIX", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
} else {
Main.getInstance().getSqlConnector().getSqlWorker().setSetting(commandEvent.getGuild().getId(), "chatprefix", commandEvent.getArguments()[0]);
sendMessage("Your new Prefix has been set to: " + commandEvent.getArguments()[0], 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 Unban method onPerform.
@Override
public void onPerform(CommandEvent commandEvent) {
if (commandEvent.getMember().hasPermission(Permission.ADMINISTRATOR)) {
if (commandEvent.isSlashCommand()) {
OptionMapping targetOption = commandEvent.getSlashCommandInteractionEvent().getOption("id");
if (targetOption != null) {
commandEvent.getGuild().unban(targetOption.getAsString()).queue();
sendMessage("User <@" + targetOption.getAsString() + "> has been unbanned!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
} else {
sendMessage("No User was given to Unban!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
}
} else {
if (commandEvent.getArguments().length == 1) {
String userId = commandEvent.getArguments()[0];
commandEvent.getGuild().unban(userId).queue();
sendMessage("User <@" + userId + "> has been unbanned!", 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() + "unban @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
}
}
} else {
sendMessage("You dont have the Permission for this Command!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
}
deleteMessage(commandEvent.getMessage(), commandEvent.getInteractionHook());
}
Aggregations