Search in sources :

Example 6 with LogUtils

use of main.utils.json.logs.LogUtils in project Robertify-Bot by bombies.

the class EightDFilter 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.getRotation() != null) {
        filters.setRotation(null).commit();
        msg.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "You have turned **off** the **8D** filter").build()).queue();
        new LogUtils().sendLog(guild, LogType.FILTER_TOGGLE, ctx.getAuthor().getAsMention() + " has turned the 8D filter off");
    } else {
        filters.setRotation(new Rotation().setFrequency(0.05F)).commit();
        msg.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "You have turned **on** the **8D** filter").build()).queue();
        new LogUtils().sendLog(guild, LogType.FILTER_TOGGLE, ctx.getAuthor().getAsMention() + " has turned the 8D filter on");
    }
}
Also used : GuildVoiceState(net.dv8tion.jda.api.entities.GuildVoiceState) LogUtils(main.utils.json.logs.LogUtils) Rotation(lavalink.client.io.filters.Rotation)

Example 7 with LogUtils

use of main.utils.json.logs.LogUtils in project Robertify-Bot by bombies.

the class EightDFilter 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.getRotation() != null) {
        filters.setRotation(null).commit();
        event.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "You have turned **off** the **8D** filter").build()).queue();
        new LogUtils().sendLog(guild, LogType.FILTER_TOGGLE, event.getUser().getAsMention() + " has turned the 8D filter off");
    } else {
        filters.setRotation(new Rotation().setFrequency(0.05F)).commit();
        event.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "You have turned **on** the **8D** filter").build()).queue();
        new LogUtils().sendLog(guild, LogType.FILTER_TOGGLE, event.getUser().getAsMention() + " has turned the 8D filter on");
    }
}
Also used : GuildVoiceState(net.dv8tion.jda.api.entities.GuildVoiceState) LogUtils(main.utils.json.logs.LogUtils) Rotation(lavalink.client.io.filters.Rotation)

Example 8 with LogUtils

use of main.utils.json.logs.LogUtils in project Robertify-Bot by bombies.

the class NightcoreFilter 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.getTimescale() != null) {
        filters.setTimescale(null).commit();
        event.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "You have turned **off** the **Nightcore** filter").build()).queue();
        new LogUtils().sendLog(guild, LogType.FILTER_TOGGLE, event.getUser().getAsMention() + " has turned the Nightcore filter off");
    } else {
        filters.setTimescale(new Timescale().setPitch(1.5F)).commit();
        event.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "You have turned **on** the **Nightcore** filter").build()).queue();
        new LogUtils().sendLog(guild, LogType.FILTER_TOGGLE, event.getUser().getAsMention() + " has turned the Nightcore filter on");
    }
}
Also used : GuildVoiceState(net.dv8tion.jda.api.entities.GuildVoiceState) LogUtils(main.utils.json.logs.LogUtils) Timescale(lavalink.client.io.filters.Timescale)

Example 9 with LogUtils

use of main.utils.json.logs.LogUtils in project Robertify-Bot by bombies.

the class TremoloFilter 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.getTremolo() != null) {
        filters.setTremolo(null).commit();
        event.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "You have turned **off** the **Tremolo** filter").build()).queue();
        new LogUtils().sendLog(guild, LogType.FILTER_TOGGLE, event.getUser().getAsMention() + " has turned the Tremolo filter off");
    } else {
        filters.setTremolo(new Tremolo()).commit();
        event.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "You have turned **on** the **Tremolo** filter").build()).queue();
        new LogUtils().sendLog(guild, LogType.FILTER_TOGGLE, event.getUser().getAsMention() + " has turned the Tremolo filter on");
    }
}
Also used : GuildVoiceState(net.dv8tion.jda.api.entities.GuildVoiceState) LogUtils(main.utils.json.logs.LogUtils) Tremolo(lavalink.client.io.filters.Tremolo)

Example 10 with LogUtils

use of main.utils.json.logs.LogUtils in project Robertify-Bot by bombies.

the class TremoloFilter 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.getTremolo() != null) {
        filters.setTremolo(null).commit();
        msg.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "You have turned **off** the **Tremolo** filter").build()).queue();
        new LogUtils().sendLog(guild, LogType.FILTER_TOGGLE, ctx.getAuthor().getAsMention() + " has turned the Tremolo filter off");
    } else {
        filters.setTremolo(new Tremolo()).commit();
        msg.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "You have turned **on** the **Tremolo** filter").build()).queue();
        new LogUtils().sendLog(guild, LogType.FILTER_TOGGLE, ctx.getAuthor().getAsMention() + " has turned the Tremolo filter on");
    }
}
Also used : GuildVoiceState(net.dv8tion.jda.api.entities.GuildVoiceState) LogUtils(main.utils.json.logs.LogUtils) Tremolo(lavalink.client.io.filters.Tremolo)

Aggregations

LogUtils (main.utils.json.logs.LogUtils)30 GuildVoiceState (net.dv8tion.jda.api.entities.GuildVoiceState)13 EmbedBuilder (net.dv8tion.jda.api.EmbedBuilder)11 DedicatedChannelConfig (main.utils.json.dedicatedchannel.DedicatedChannelConfig)9 AudioTrack (com.sedmelluq.discord.lavaplayer.track.AudioTrack)8 AudioTrackInfo (com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo)7 ArrayList (java.util.ArrayList)4 Guild (net.dv8tion.jda.api.entities.Guild)4 Karaoke (lavalink.client.io.filters.Karaoke)2 Rotation (lavalink.client.io.filters.Rotation)2 Timescale (lavalink.client.io.filters.Timescale)2 Tremolo (lavalink.client.io.filters.Tremolo)2 Vibrato (lavalink.client.io.filters.Vibrato)2 Message (net.dv8tion.jda.api.entities.Message)2 Stack (java.util.Stack)1 AutoPlayException (main.exceptions.AutoPlayException)1