Search in sources :

Example 6 with EmbedBuilder

use of net.dv8tion.jda.core.EmbedBuilder in project DiscordBot by LXGaming.

the class SkipCommand method execute.

@Override
public void execute(TextChannel textChannel, Member member, Message message, List<String> arguments) {
    EmbedBuilder embedBuilder = new EmbedBuilder();
    embedBuilder.setAuthor(textChannel.getJDA().getSelfUser().getName(), null, textChannel.getJDA().getSelfUser().getEffectiveAvatarUrl());
    embedBuilder.setColor(DiscordUtil.DEFAULT);
    if (DiscordBot.getInstance().getDiscord().getAudioQueue().isRepeatSong()) {
        embedBuilder.setColor(DiscordUtil.WARNING);
        DiscordBot.getInstance().getDiscord().getAudioQueue().setRepeatSong(false);
        embedBuilder.setTitle("Repeat is now off, Skipping...", null);
    } else {
        embedBuilder.setColor(DiscordUtil.SUCCESS);
        embedBuilder.setTitle("Skipping...", null);
    }
    DiscordBot.getInstance().getDiscord().getAudioQueue().playNext();
    DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(textChannel, embedBuilder.build(), true);
}
Also used : EmbedBuilder(net.dv8tion.jda.core.EmbedBuilder)

Example 7 with EmbedBuilder

use of net.dv8tion.jda.core.EmbedBuilder in project DiscordBot by LXGaming.

the class JoinCommand method execute.

@Override
public void execute(TextChannel textChannel, Member member, Message message, List<String> arguments) {
    EmbedBuilder embedBuilder = new EmbedBuilder();
    embedBuilder.setAuthor(textChannel.getJDA().getSelfUser().getName(), null, textChannel.getJDA().getSelfUser().getEffectiveAvatarUrl());
    embedBuilder.setColor(DiscordUtil.DEFAULT);
    if (arguments == null || arguments.isEmpty()) {
        embedBuilder.setColor(DiscordUtil.ERROR);
        embedBuilder.setTitle("Invalid arguments!", null);
        DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(textChannel, embedBuilder.build(), true);
        return;
    }
    List<VoiceChannel> voiceChannels = member.getGuild().getVoiceChannelsByName(arguments.get(0), false);
    if (voiceChannels.size() < 1) {
        embedBuilder.setColor(DiscordUtil.ERROR);
        embedBuilder.setTitle("Unable to find specified voice channel!", null);
        DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(textChannel, embedBuilder.build(), true);
        return;
    }
    if (member.getGuild().getAudioManager().getConnectedChannel() != null) {
        member.getGuild().getAudioManager().closeAudioConnection();
    }
    try {
        member.getGuild().getAudioManager().openAudioConnection(voiceChannels.get(0));
        embedBuilder.setColor(DiscordUtil.SUCCESS);
        embedBuilder.setTitle("Joined channel '" + voiceChannels.get(0).getName() + "'.", null);
        DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(textChannel, embedBuilder.build(), true);
    } catch (RuntimeException ex) {
        embedBuilder.setColor(DiscordUtil.ERROR);
        embedBuilder.addField("Cannot join channel '" + voiceChannels.get(0).getName() + "'!", ex.getMessage(), false);
        DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(textChannel, embedBuilder.build(), true);
    }
}
Also used : EmbedBuilder(net.dv8tion.jda.core.EmbedBuilder) VoiceChannel(net.dv8tion.jda.core.entities.VoiceChannel)

Example 8 with EmbedBuilder

use of net.dv8tion.jda.core.EmbedBuilder in project MOOTBoot by LeshDev.

the class serverInfo method onMessageReceived.

public void onMessageReceived(MessageReceivedEvent e) {
    Message msg = e.getMessage();
    EmbedBuilder eB = new EmbedBuilder();
    if (!msg.getRawContent().startsWith("-server") || bannedList.black.contains(e.getAuthor().getIdLong()) || e.getAuthor().isBot()) {
        return;
    }
    eB.setAuthor("Server Infos", null, lib.bot_image);
    eB.addField("**Owner**", "" + e.getGuild().getOwner().getEffectiveName(), true);
    eB.addField("**Name**", "" + e.getGuild().getName(), true);
    eB.addField("**Region**", e.getGuild().getRegion().getName(), true);
    eB.setThumbnail(e.getGuild().getIconUrl());
    eB.setColor(java.awt.Color.RED);
    e.getChannel().sendMessage(eB.build()).queue();
}
Also used : EmbedBuilder(net.dv8tion.jda.core.EmbedBuilder) Message(net.dv8tion.jda.core.entities.Message)

Example 9 with EmbedBuilder

use of net.dv8tion.jda.core.EmbedBuilder in project MOOTBoot by LeshDev.

the class userInfo method sendInfo.

public static void sendInfo(Member member, TextChannel channel) {
    EmbedBuilder eB = new EmbedBuilder();
    User u = member.getUser();
    eB.setAuthor("Infocard >> " + u.getName(), null, u.getEffectiveAvatarUrl());
    eB.addField("**User**:", u.getAsMention(), true);
    eB.addField("**ID**:", "" + u.getIdLong(), true);
    eB.addField("**Message Frequency**:", "" + channel.getHistory().retrievePast(MESSAGE_LOOKBACK_COUNT).complete().stream().filter(e -> e.getAuthor().equals(u)).count() / ((double) MESSAGE_LOOKBACK_COUNT), true);
    eB.addField("**Created**:", "" + u.getCreationTime(), true);
    eB.addField("**Roles**:", "" + member.getRoles().stream().map(Role::getName).collect(Collectors.joining(" - ")), true);
    eB.setThumbnail(u.getEffectiveAvatarUrl());
    eB.setColor(java.awt.Color.CYAN);
    channel.sendMessage(eB.build()).queue();
}
Also used : EmbedBuilder(net.dv8tion.jda.core.EmbedBuilder) User(net.dv8tion.jda.core.entities.User)

Example 10 with EmbedBuilder

use of net.dv8tion.jda.core.EmbedBuilder in project MOOTBoot by LeshDev.

the class botHelp method onMessageReceived.

public void onMessageReceived(MessageReceivedEvent e) {
    Message msg = e.getMessage();
    if (!msg.getRawContent().startsWith("-help") || bannedList.black.contains(e.getAuthor().getIdLong()) || e.getAuthor().isBot()) {
        return;
    }
    EmbedBuilder eB = new EmbedBuilder();
    eB.setAuthor("Help Menu for " + lib.bot_name, null, lib.bot_image);
    eB.addField("**Bot Info**", "-info > Gives infos about the bot", true);
    eB.addField("**User Info**", "-user <@User> > Gives infos about the user", true);
    eB.addField("**Change Game**", "-game <String> > Change the 'Playing' status", true);
    eB.addField("**Server Info**", "-server > Gives infos about the server", true);
    eB.addField("**Ideen**", "-ideen / -ideen add > Shows Ideas list / Add new ideas", true);
    eB.addField("**Ping**", "-ping > Shows ping from user and bot", true);
    eB.addField("**Clock**", "-clock > Shows current time", true);
    eB.setColor(java.awt.Color.YELLOW);
    e.getChannel().sendMessage(eB.build()).queue();
}
Also used : EmbedBuilder(net.dv8tion.jda.core.EmbedBuilder) Message(net.dv8tion.jda.core.entities.Message)

Aggregations

EmbedBuilder (net.dv8tion.jda.core.EmbedBuilder)73 Message (net.dv8tion.jda.core.entities.Message)15 GuildMessageReceivedEvent (net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent)13 ArrayList (java.util.ArrayList)12 Guild (net.dv8tion.jda.core.entities.Guild)11 MessageEmbed (net.dv8tion.jda.core.entities.MessageEmbed)11 MantaroData (net.kodehawa.mantarobot.data.MantaroData)11 DBGuild (net.kodehawa.mantarobot.data.entities.DBGuild)11 EmoteReference (net.kodehawa.mantarobot.utils.commands.EmoteReference)11 Color (java.awt.Color)10 User (net.dv8tion.jda.core.entities.User)10 Command (net.kodehawa.mantarobot.modules.Command)10 SimpleCommand (net.kodehawa.mantarobot.modules.commands.SimpleCommand)10 TimeUnit (java.util.concurrent.TimeUnit)9 Utils (net.kodehawa.mantarobot.utils.Utils)9 List (java.util.List)8 Collectors (java.util.stream.Collectors)8 GuildData (net.kodehawa.mantarobot.data.entities.helpers.GuildData)8 CommandRegistry (net.kodehawa.mantarobot.modules.CommandRegistry)8 Module (net.kodehawa.mantarobot.modules.Module)8