use of net.dv8tion.jda.api.EmbedBuilder in project c0debaseBot by Biospheere.
the class ClearCommand method execute.
@Override
public void execute(final String[] args, final Message message) {
if (args.length == 0) {
final EmbedBuilder embedBuilder = getEmbed(message.getMember());
embedBuilder.appendDescription("!clear <Amount>");
message.getTextChannel().sendMessage(embedBuilder.build()).queue();
} else {
int i = 0;
try {
i = Integer.valueOf(args[0]);
} catch (NumberFormatException ex) {
ex.printStackTrace();
}
final MessageHistory history = new MessageHistory(message.getTextChannel());
final List<Message> messages = history.retrievePast(i + 1).complete();
message.getTextChannel().deleteMessages(messages).queue();
final EmbedBuilder embedBuilder = DiscordUtils.getDefaultEmbed(message.getMember());
embedBuilder.setColor(message.getGuild().getSelfMember().getColor());
embedBuilder.appendDescription("Es wurden **" + (i) + "** Nachrichten gelöscht");
message.getTextChannel().sendMessage(embedBuilder.build()).queue();
}
}
use of net.dv8tion.jda.api.EmbedBuilder in project c0debaseBot by Biospheere.
the class PingCommand method execute.
@Override
public void execute(final String[] args, final Message message) {
final EmbedBuilder embedBuilder = getEmbed(message.getMember());
embedBuilder.appendDescription(":stopwatch: " + message.getJDA().getGatewayPing() + " (Websocket)\n\n");
embedBuilder.appendDescription(":stopwatch: " + message.getJDA().getRestPing().complete() + " (Rest)");
message.getTextChannel().sendMessage(embedBuilder.build()).queue();
}
use of net.dv8tion.jda.api.EmbedBuilder in project c0debaseBot by Biospheere.
the class RoleCommand method changeRole.
private void changeRole(final String args, final Message message) {
final List<Role> addRoles = new ArrayList<>();
final List<Role> removeRoles = new ArrayList<>();
for (final String role : args.split(" ")) {
if (isRoleAvailable(role, message.getGuild())) {
addRolesToList(message.getMember(), role, addRoles, removeRoles);
} else if (isRoleAvailable("Color-" + role, message.getGuild())) {
addRolesToList(message.getMember(), "Color-" + role, addRoles, removeRoles);
}
}
message.getGuild().modifyMemberRoles(message.getMember(), addRoles, removeRoles).queue(sucess -> {
final EmbedBuilder embedBuilder = getEmbed(message.getGuild(), message.getAuthor());
embedBuilder.setTitle("Rolle(n) geupdatet");
embedBuilder.appendDescription("Du bist " + addRoles.size() + (addRoles.size() > 1 ? " Rollen " : " Rolle ") + "beigetreten\n");
embedBuilder.appendDescription("Du hast " + removeRoles.size() + (removeRoles.size() == 1 ? " Rolle " : " Rollen ") + "verlassen");
message.getTextChannel().sendMessage(embedBuilder.build()).queue();
});
}
use of net.dv8tion.jda.api.EmbedBuilder in project c0debaseBot by Biospheere.
the class AskCommand method execute.
@Override
public void execute(String[] args, Message message) {
final EmbedBuilder embedBuilder = getEmbed(message.getGuild(), message.getAuthor());
embedBuilder.setTitle("Wie man Fragen richtig stellt", "https://www.dontasktoask.com/");
embedBuilder.appendDescription("Zur schnellen Problemlösung solltest Du folgende Tipps berücksichtigen: \n\n");
embedBuilder.appendDescription("1. Eigeninitiative. Sprich, einfach mal das Internet benutzen.\n");
embedBuilder.appendDescription("2. Red nicht lange drum herum, komm zum Punkt.\n");
embedBuilder.appendDescription("3. Sei nicht sparsam und gib so viele Infos wie möglich.\n");
embedBuilder.appendDescription("4. Schick Deinen Code ruhig mit.\n");
embedBuilder.appendDescription("5. Lies Dir nochmal Deine Nachricht durch.\n\n");
embedBuilder.appendDescription("[Mehr zum Thema findest Du hier.](https://gist.github.com/finreinhard/b842b690255bb80d929f8a5467d75597)");
message.getTextChannel().sendMessage(embedBuilder.build()).queue();
}
use of net.dv8tion.jda.api.EmbedBuilder in project c0debaseBot by Biospheere.
the class ColorCommand method execute.
@Override
public void execute(final String[] args, final Message message) {
final EmbedBuilder embedBuilder = getEmbed(message.getMember());
if (args.length > 0) {
if (VALID_HEX_CODE.matcher(args[0].replace("#", "")).matches()) {
embedBuilder.setTitle("Color-Code-Preview").setDescription("Farbcode Vorschau für: " + args[0]).setImage("https://dummyimage.com/250x250/" + args[0].replace("#", "") + "/" + args[0].replace("#", "") + ".png");
} else {
embedBuilder.setDescription("Kein Hex Code gefunden :hushed:");
}
} else {
embedBuilder.setDescription("!color [code]");
}
message.getTextChannel().sendMessage(embedBuilder.build()).queue();
}
Aggregations