Skip to content
This repository has been archived by the owner on Oct 18, 2021. It is now read-only.

Commit

Permalink
Merge pull request #23 from zekroTJA/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ゼクロ authored Jul 17, 2017
2 parents 2dcf225 + c50bcdd commit 79d5e8e
Show file tree
Hide file tree
Showing 26 changed files with 173 additions and 101 deletions.
2 changes: 1 addition & 1 deletion src/main/java/commands/administration/Guilds.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void action(String[] args, MessageReceivedEvent event) throws ParseExcept
try {
g = event.getJDA().getGuildById(args[1]);
} catch (Exception e) {
event.getTextChannel().sendMessage(MSGS.error.setDescription("There is no guild with the entered ID.").build()).queue();
event.getTextChannel().sendMessage(MSGS.error().setDescription("There is no guild with the entered ID.").build()).queue();
return;
}

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/commands/chat/BJoke.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ public void action(String[] args, final MessageReceivedEvent event) {
if (args[0].toLowerCase().equals("c")) {

if (victim == null) {
event.getTextChannel().sendMessage(MSGS.error.setDescription("There is currently no victim to save. :^)").build()).queue();
event.getTextChannel().sendMessage(MSGS.error().setDescription("There is currently no victim to save. :^)").build()).queue();
return;
}

if (event.getMember().equals(victim)) {
event.getTextChannel().sendMessage(MSGS.error.setDescription("Sorry, " + event.getAuthor().getAsMention() + ", you can't free yourself from your fate...").build()).queue();
event.getTextChannel().sendMessage(MSGS.error().setDescription("Sorry, " + event.getAuthor().getAsMention() + ", you can't free yourself from your fate...").build()).queue();
return;
}

Expand All @@ -52,15 +52,15 @@ public void action(String[] args, final MessageReceivedEvent event) {
countdown.cancel();
countdown = new Timer();
count = 10;
event.getTextChannel().sendMessage(MSGS.success.setDescription("You had luck, " + victim.getAsMention() + ". " + event.getAuthor().getAsMention() + " freed you from the kick.").build()).queue();
event.getTextChannel().sendMessage(MSGS.success().setDescription("You had luck, " + victim.getAsMention() + ". " + event.getAuthor().getAsMention() + " freed you from the kick.").build()).queue();
victim = null;
return;
}

try {
victim = event.getGuild().getMember(event.getMessage().getMentionedUsers().get(0));
} catch (Exception e) {
event.getTextChannel().sendMessage(MSGS.error.setDescription(help()).build()).queue();
event.getTextChannel().sendMessage(MSGS.error().setDescription(help()).build()).queue();
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/commands/chat/Cat.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void action(String[] args, MessageReceivedEvent event) {
delay = Integer.parseInt(args[1]);
if (delay < 5) {
delay = 5;
event.getTextChannel().sendMessage(MSGS.error.setDescription("The minumum time period is 5 seconds because of spam protection. ;)").build()).queue();
event.getTextChannel().sendMessage(MSGS.error().setDescription("The minumum time period is 5 seconds because of spam protection. ;)").build()).queue();
}
} catch (Exception e) {
delay = 10;
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/commands/chat/Clear.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void action(String[] args, MessageReceivedEvent event) {
//Nichts tun
}

Message answer = event.getTextChannel().sendMessage(MSGS.success.setDescription(
Message answer = event.getTextChannel().sendMessage(MSGS.success().setDescription(
"Successfully deleted all messages!"
).build()).complete();

Expand All @@ -77,7 +77,7 @@ public void run() {
msgs = history.retrievePast(2).complete();
msgs.get(0).delete().queue();

Message answer = event.getTextChannel().sendMessage(MSGS.success.setDescription(
Message answer = event.getTextChannel().sendMessage(MSGS.success().setDescription(
"Successfully deleted last message!"
).build()).complete();

Expand Down Expand Up @@ -113,7 +113,7 @@ public void run() {

}

Message answer = event.getTextChannel().sendMessage(MSGS.success.setDescription(
Message answer = event.getTextChannel().sendMessage(MSGS.success().setDescription(
"Successfully deleted " + args[0] + " messages!"
).build()).complete();

Expand All @@ -129,7 +129,7 @@ public void run() {
}
catch (ParseException ex)
{
event.getTextChannel().sendMessage(MSGS.error
event.getTextChannel().sendMessage(MSGS.error()
.addField("Error Type", "Wrong Timeformat.", false)
.addField("Description", "Pleas enter the Time in the right Timeformat:\n" + simpleDateFormat.format(new Date()), false)
.build()
Expand All @@ -142,7 +142,7 @@ public void run() {
msgs = history.retrievePast(getInt(args[0])).complete();
event.getTextChannel().deleteMessages(msgs).queue();

Message answer = event.getTextChannel().sendMessage(MSGS.success.setDescription(
Message answer = event.getTextChannel().sendMessage(MSGS.success().setDescription(
"Successfully deleted " + args[0] + " messages!"
).build()).complete();

Expand All @@ -153,7 +153,7 @@ public void run() {
}
}, 3000);
} else {
event.getTextChannel().sendMessage(MSGS.error
event.getTextChannel().sendMessage(MSGS.error()
.addField("Error Type", "Message value out of bounds.", false)
.addField("Description", "The entered number if messages can not be more than 100 messages!", false)
.build()
Expand All @@ -162,7 +162,7 @@ public void run() {


} catch (Exception e) {
event.getTextChannel().sendMessage(MSGS.error
event.getTextChannel().sendMessage(MSGS.error()
.addField("Error Type", e.getLocalizedMessage(), false)
.addField("Message", e.getMessage(), false)
.build()
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/commands/chat/Quote.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public boolean called(String[] args, MessageReceivedEvent event) {
public void action(String[] args, MessageReceivedEvent event) throws ParseException, IOException {

if (args.length < 1) {
event.getTextChannel().sendMessage(MSGS.error.setDescription(help()).build()).queue();
event.getTextChannel().sendMessage(MSGS.error().setDescription(help()).build()).queue();
return;
}

Expand All @@ -44,7 +44,7 @@ public void action(String[] args, MessageReceivedEvent event) throws ParseExcept
});

if (msg.size() < 1) {
chanMSG.editMessage(MSGS.error.setDescription(
chanMSG.editMessage(MSGS.error().setDescription(
"There is no message in any chat on this guild with the ID `" + args[0] + "`."
).build()).queue();
return;
Expand Down Expand Up @@ -74,7 +74,7 @@ public void executed(boolean success, MessageReceivedEvent event) {

@Override
public String help() {
return null;
return "**USAGE:** `-quote <msg id>`";
}

@Override
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/commands/chat/Vote2.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public Poll(Guild guild, Member creator, Message message, List<String> content)
private void createPoll(String[] args, MessageReceivedEvent event) {

if (voteHash.containsKey(event.getGuild())) {
event.getTextChannel().sendMessage(MSGS.error.setDescription("A poll is currently running! Please close that poll before opening another one!").build()).queue();
event.getTextChannel().sendMessage(MSGS.error().setDescription("A poll is currently running! Please close that poll before opening another one!").build()).queue();
return;
}

Expand Down Expand Up @@ -82,26 +82,26 @@ private void createPoll(String[] args, MessageReceivedEvent event) {
private void votePoll(String[] args, MessageReceivedEvent event) {

if (args.length < 2) {
event.getTextChannel().sendMessage(MSGS.error.setDescription(help()).build()).queue();
event.getTextChannel().sendMessage(MSGS.error().setDescription(help()).build()).queue();
return;
} else if (!voteHash.containsKey(event.getGuild())) {
event.getTextChannel().sendMessage(MSGS.error.setDescription("There is currently no poll running to vote for!").build()).queue();
event.getTextChannel().sendMessage(MSGS.error().setDescription("There is currently no poll running to vote for!").build()).queue();
return;
} else if (voteHash.get(event.getGuild()).votes.containsKey(event.getMember())) {
event.getTextChannel().sendMessage(MSGS.error.setDescription("Sorry, " + event.getAuthor().getAsMention() + ", you can only vote **once** for a poll!").build()).queue();
event.getTextChannel().sendMessage(MSGS.error().setDescription("Sorry, " + event.getAuthor().getAsMention() + ", you can only vote **once** for a poll!").build()).queue();
return;
}

int votenumb;
try {
votenumb = Integer.parseInt(args[1]);
} catch (Exception e) {
event.getTextChannel().sendMessage(MSGS.error.setDescription("Please enter a valid number as vote.").build()).queue();
event.getTextChannel().sendMessage(MSGS.error().setDescription("Please enter a valid number as vote.").build()).queue();
return;
}

if (votenumb > voteHash.get(event.getGuild()).content.stream().skip(1).count()) {
event.getTextChannel().sendMessage(MSGS.error.setDescription("Please enter a valid number as vote.").build()).queue();
event.getTextChannel().sendMessage(MSGS.error().setDescription("Please enter a valid number as vote.").build()).queue();
return;
}

Expand All @@ -114,7 +114,7 @@ private void votePoll(String[] args, MessageReceivedEvent event) {
private void statsPoll(MessageReceivedEvent event) {

if (!voteHash.containsKey(event.getGuild())) {
event.getTextChannel().sendMessage(MSGS.error.setDescription("There is currently no poll running!").build()).queue();
event.getTextChannel().sendMessage(MSGS.error().setDescription("There is currently no poll running!").build()).queue();
return;
}

Expand All @@ -137,7 +137,7 @@ private void statsPoll(MessageReceivedEvent event) {
private void closePoll(MessageReceivedEvent event) {

if (!voteHash.containsKey(event.getGuild())) {
event.getTextChannel().sendMessage(MSGS.error.setDescription("There is currently no poll running to vote for!").build()).queue();
event.getTextChannel().sendMessage(MSGS.error().setDescription("There is currently no poll running to vote for!").build()).queue();
return;
}

Expand All @@ -146,7 +146,7 @@ private void closePoll(MessageReceivedEvent event) {
voteHash.remove(event.getGuild());
event.getTextChannel().sendMessage(new EmbedBuilder().setColor(new Color(0xFF5600)).setDescription("Vote closed by " + event.getMember().getAsMention() + ".").build()).queue();
} else {
event.getTextChannel().sendMessage(MSGS.error.setDescription("Sorry, " + event.getMember().getAsMention() + ", only the creator of the poll or a member with at least permission level 1 can close a running poll.").build()).queue();
event.getTextChannel().sendMessage(MSGS.error().setDescription("Sorry, " + event.getMember().getAsMention() + ", only the creator of the poll or a member with at least permission level 1 can close a running poll.").build()).queue();
}

}
Expand All @@ -161,7 +161,7 @@ public boolean called(String[] args, MessageReceivedEvent event) {
public void action(String[] args, MessageReceivedEvent event) throws ParseException, IOException {

if (args.length < 1) {
event.getTextChannel().sendMessage(MSGS.error.setDescription(help()).build()).queue();
event.getTextChannel().sendMessage(MSGS.error().setDescription(help()).build()).queue();
}

switch (args[0]) {
Expand All @@ -188,7 +188,7 @@ public void action(String[] args, MessageReceivedEvent event) throws ParseExcept
break;

default:
event.getTextChannel().sendMessage(MSGS.error.setDescription(help()).build()).queue();
event.getTextChannel().sendMessage(MSGS.error().setDescription(help()).build()).queue();
}

}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/commands/chat/WarframeAlerts.java
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,12 @@ public void run() {
case "channel":

if (args.length < 2) {
event.getTextChannel().sendMessage(MSGS.error.setDescription("Please enter a valid text channel!").build()).queue();
event.getTextChannel().sendMessage(MSGS.error().setDescription("Please enter a valid text channel!").build()).queue();
return;
}

SSSS.setWARFRAMELAERTSCHAN(args[1].toLowerCase(), event.getGuild());
event.getTextChannel().sendMessage(MSGS.success.setDescription("Successfully set warframe alerts channel to `" + args[1].toLowerCase() + "`").build()).queue();
event.getTextChannel().sendMessage(MSGS.success().setDescription("Successfully set warframe alerts channel to `" + args[1].toLowerCase() + "`").build()).queue();
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/commands/essentials/Help.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void action(String[] args, MessageReceivedEvent event) {

StringBuilder ciams = new StringBuilder();

String[] ignorers = {"test", "c", "bj", "ttt", "userinfo", "dev", "nudge", "poll", "moveall", "purge", "info", "suggestion", "r6", };
String[] ignorers = {"test", "r", "c", "bj", "ttt", "userinfo", "dev", "nudge", "poll", "moveall", "purge", "info", "suggestion", "r6", };
Arrays.stream(ignorers).forEach(s -> cmds.remove(s));


Expand Down
4 changes: 2 additions & 2 deletions src/main/java/commands/etc/Bug.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class Bug implements Command {


public static void sendConfMessage() {
MESSAGE.getTextChannel().sendMessage(MSGS.success.setDescription("Submit sucesfully send!").build()).queue();
MESSAGE.getTextChannel().sendMessage(MSGS.success().setDescription("Submit sucesfully send!").build()).queue();
}


Expand All @@ -58,7 +58,7 @@ public void action(String[] args, MessageReceivedEvent event) throws ParseExcept
).build()).queue();
return;
}
event.getTextChannel().sendMessage(MSGS.error.setDescription(
event.getTextChannel().sendMessage(MSGS.error().setDescription(
"Sorry, the expandet version of this command is only available on the public version of the bot!\n\n" +
"If you want to submit a bug or a suggestion, please use the public **[google sheet](https://s.zekro.de/botsubs)**."
).build()).queue();
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/commands/etc/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ public void action(String[] args, MessageReceivedEvent event) throws ParseExcept
if (f.exists()) {
if (f.delete()) {
f.createNewFile();
event.getTextChannel().sendMessage(MSGS.success.setDescription("Successfully cleared log file.").build()).queue();
event.getTextChannel().sendMessage(MSGS.success().setDescription("Successfully cleared log file.").build()).queue();
} else {
event.getTextChannel().sendMessage(MSGS.error.setDescription("Failed while attempting to clear log file.").build()).queue();
event.getTextChannel().sendMessage(MSGS.error().setDescription("Failed while attempting to clear log file.").build()).queue();
}
}
return;
Expand Down Expand Up @@ -114,7 +114,7 @@ public void action(String[] args, MessageReceivedEvent event) throws ParseExcept

} else {

event.getTextChannel().sendMessage(MSGS.error.setDescription("There is no file `'screenlog.0'` available to get log from.").build()).queue();
event.getTextChannel().sendMessage(MSGS.error().setDescription("There is no file `'screenlog.0'` available to get log from.").build()).queue();

}

Expand Down
Loading

0 comments on commit 79d5e8e

Please sign in to comment.