Search in sources :

Example 11 with LogUtils

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");
    }
}
Also used : Vibrato(lavalink.client.io.filters.Vibrato) GuildVoiceState(net.dv8tion.jda.api.entities.GuildVoiceState) LogUtils(main.utils.json.logs.LogUtils)

Example 12 with LogUtils

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");
    }
}
Also used : Vibrato(lavalink.client.io.filters.Vibrato) GuildVoiceState(net.dv8tion.jda.api.entities.GuildVoiceState) LogUtils(main.utils.json.logs.LogUtils)

Example 13 with LogUtils

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();
    }
}
Also used : Message(net.dv8tion.jda.api.entities.Message) LogUtils(main.utils.json.logs.LogUtils) Guild(net.dv8tion.jda.api.entities.Guild)

Example 14 with LogUtils

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());
}
Also used : EmbedBuilder(net.dv8tion.jda.api.EmbedBuilder) GuildVoiceState(net.dv8tion.jda.api.entities.GuildVoiceState) LogUtils(main.utils.json.logs.LogUtils)

Example 15 with LogUtils

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();
}
Also used : EmbedBuilder(net.dv8tion.jda.api.EmbedBuilder) GuildVoiceState(net.dv8tion.jda.api.entities.GuildVoiceState) LogUtils(main.utils.json.logs.LogUtils) Guild(net.dv8tion.jda.api.entities.Guild)

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