use of main.utils.json.logs.LogUtils in project Robertify-Bot by bombies.
the class VibratoFilter method onSlashCommand.
@Override
public void onSlashCommand(@NotNull SlashCommandEvent event) {
if (!checksWithPremium(event))
return;
sendRandomMessage(event);
final var guild = event.getGuild();
final var musicManager = RobertifyAudioManager.getInstance().getMusicManager(guild);
final var audioPlayer = musicManager.getPlayer();
final var filters = audioPlayer.getFilters();
final var selfMember = guild.getSelfMember();
if (!selfMember.getVoiceState().inVoiceChannel()) {
event.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "I must be in a voice channel in order for this command to work!").build()).setEphemeral(true).queue();
return;
}
GuildVoiceState memberVoiceState = event.getMember().getVoiceState();
if (!memberVoiceState.inVoiceChannel()) {
event.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "You must be in the same voice channel as me to use this command").build()).setEphemeral(true).queue();
return;
}
if (!memberVoiceState.getChannel().equals(selfMember.getVoiceState().getChannel())) {
event.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "You must be in the same voice channel as me to use this command").build()).setEphemeral(true).queue();
return;
}
if (filters.getVibrato() != null) {
filters.setVibrato(null).commit();
event.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "You have turned **off** the **Vibrato** filter").build()).queue();
new LogUtils().sendLog(guild, LogType.FILTER_TOGGLE, event.getUser().getAsMention() + " has turned the Vibrato filter off");
} else {
filters.setVibrato(new Vibrato()).commit();
event.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "You have turned **on** the **Vibrato** filter").build()).queue();
new LogUtils().sendLog(guild, LogType.FILTER_TOGGLE, event.getUser().getAsMention() + " has turned the Vibrato filter on");
}
}
use of main.utils.json.logs.LogUtils in project Robertify-Bot by bombies.
the class VibratoFilter method handle.
@Override
public void handle(CommandContext ctx) throws ScriptException {
final var guild = ctx.getGuild();
final var msg = ctx.getMessage();
final var musicManager = RobertifyAudioManager.getInstance().getMusicManager(guild);
final var audioPlayer = musicManager.getPlayer();
final var filters = audioPlayer.getFilters();
final var selfMember = ctx.getSelfMember();
if (!selfMember.getVoiceState().inVoiceChannel()) {
msg.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "I must be in a voice channel in order for this command to work!").build()).queue();
return;
}
GuildVoiceState memberVoiceState = ctx.getMember().getVoiceState();
if (!memberVoiceState.inVoiceChannel()) {
msg.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "You must be in the same voice channel as me to use this command").build()).queue();
return;
}
if (!memberVoiceState.getChannel().equals(selfMember.getVoiceState().getChannel())) {
msg.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "You must be in the same voice channel as me to use this command").build()).queue();
return;
}
if (filters.getVibrato() != null) {
filters.setVibrato(null).commit();
msg.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "You have turned **off** the **Vibrato** filter").build()).queue();
new LogUtils().sendLog(guild, LogType.FILTER_TOGGLE, ctx.getAuthor().getAsMention() + " has turned the Vibrato filter off");
} else {
filters.setVibrato(new Vibrato()).commit();
msg.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "You have turned **on** the **Vibrato** filter").build()).queue();
new LogUtils().sendLog(guild, LogType.FILTER_TOGGLE, ctx.getAuthor().getAsMention() + " has turned the Vibrato filter on");
}
}
use of main.utils.json.logs.LogUtils in project Robertify-Bot by bombies.
the class LogCommand method handle.
@Override
public void handle(CommandContext ctx) throws ScriptException {
final Message message = ctx.getMessage();
final Guild guild = ctx.getGuild();
if (!GeneralUtils.hasPerms(guild, ctx.getMember(), main.constants.Permission.ROBERTIFY_ADMIN)) {
message.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, BotConstants.getInsufficientPermsMessage(main.constants.Permission.ROBERTIFY_ADMIN)).build()).queue();
return;
}
try {
new LogUtils().createChannel(guild);
message.addReaction("✅").queue();
} catch (IllegalArgumentException e) {
message.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "The log channel has already been setup!").build()).queue();
}
}
use of main.utils.json.logs.LogUtils in project Robertify-Bot by bombies.
the class ClearQueueSlashCommand method onSlashCommand.
@Override
public void onSlashCommand(@NotNull SlashCommandEvent event) {
if (!checks(event))
return;
sendRandomMessage(event);
event.deferReply().queue();
final var musicManager = RobertifyAudioManager.getInstance().getMusicManager(event.getGuild());
final var queue = musicManager.getScheduler().queue;
final var guild = event.getGuild();
GeneralUtils.setCustomEmbed(event.getGuild(), "Queue");
if (queue.isEmpty()) {
EmbedBuilder eb = RobertifyEmbedUtils.embedMessage(guild, "There is already nothing in the queue.");
event.getHook().sendMessageEmbeds(eb.build()).queue();
return;
}
final GuildVoiceState selfVoiceState = event.getGuild().getSelfMember().getVoiceState();
if (selfVoiceState.inVoiceChannel()) {
if (selfVoiceState.getChannel().getMembers().size() > 2) {
if (!musicCommandDJCheck(event)) {
EmbedBuilder eb = RobertifyEmbedUtils.embedMessage(guild, "You need to be a DJ to use this command when there's other users in the channel!");
event.getHook().sendMessageEmbeds(eb.build()).queue();
return;
}
}
} else {
EmbedBuilder eb = RobertifyEmbedUtils.embedMessage(guild, "The bot isn't in a voice channel.");
event.getHook().sendMessageEmbeds(eb.build()).queue();
return;
}
queue.clear();
new LogUtils().sendLog(guild, LogType.QUEUE_CLEAR, event.getUser().getAsMention() + " has cleared the queue");
EmbedBuilder eb = RobertifyEmbedUtils.embedMessage(guild, "The queue was cleared!");
event.getHook().sendMessageEmbeds(eb.build()).queue();
GeneralUtils.setDefaultEmbed(event.getGuild());
}
use of main.utils.json.logs.LogUtils in project Robertify-Bot by bombies.
the class DisconnectSlashCommand method onSlashCommand.
@Override
public void onSlashCommand(@NotNull SlashCommandEvent event) {
if (!checks(event))
return;
sendRandomMessage(event);
event.deferReply().queue();
EmbedBuilder eb;
final GuildVoiceState memberVoiceState = event.getMember().getVoiceState();
Guild guild = event.getGuild();
final GuildVoiceState selfVoiceState = guild.getSelfMember().getVoiceState();
if (!selfVoiceState.inVoiceChannel()) {
eb = RobertifyEmbedUtils.embedMessage(guild, "I'm already not in a voice channel!");
event.getHook().sendMessageEmbeds(eb.build()).queue();
return;
}
if (!memberVoiceState.inVoiceChannel()) {
eb = RobertifyEmbedUtils.embedMessage(guild, "You must be in the same voice channel as me to use this command!" + "\n\nI am currently in: " + selfVoiceState.getChannel().getAsMention());
event.getHook().sendMessageEmbeds(eb.build()).queue();
return;
}
if (!memberVoiceState.getChannel().equals(selfVoiceState.getChannel())) {
eb = RobertifyEmbedUtils.embedMessage(guild, "You must be in the same voice channel as me to use this command!" + "\n\nI am currently in: " + selfVoiceState.getChannel().getAsMention());
event.getHook().sendMessageEmbeds(eb.build()).queue();
return;
}
final var musicManager = RobertifyAudioManager.getInstance().getMusicManager(guild);
musicManager.leave();
new LogUtils().sendLog(guild, LogType.BOT_DISCONNECTED, event.getUser().getAsMention() + " has disconnected the bot.");
eb = RobertifyEmbedUtils.embedMessage(guild, "Disconnected!");
event.getHook().sendMessageEmbeds(eb.build()).queue();
}
Aggregations