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);
}
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);
}
}
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();
}
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();
}
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();
}
Aggregations