Basic changes

This commit is contained in:
Savvy
2018-01-29 20:39:31 -05:00
parent 7fdac99892
commit fb2fc4647c
3 changed files with 13 additions and 13 deletions

View File

@@ -31,13 +31,13 @@ public class PMCommand extends Command {
return;
}
msg = msg.replaceFirst(role.getAsMention(), "").replaceFirst("@" + role.getName(),"");
int usersWithRole = 0;
int sendingSuccess = 0;
int sendingFailed = 0;
String finalMsg = msg;
for (Member memberWithRole : guild.getMembersWithRoles(role)) {
try {
memberWithRole.getUser().openPrivateChannel().queue(privateChannel -> privateChannel.sendMessage(finalMsg).queue());
usersWithRole++;
sendingSuccess++;
} catch (ErrorResponseException ex) {
if (ex.getErrorResponse() == ErrorResponse.CANNOT_SEND_TO_USER)
sendingFailed++;
@@ -46,6 +46,6 @@ public class PMCommand extends Command {
MessageFactory.create(msg)
.setAuthor("Private Message: " + role.getName(), guild.getIconUrl())
.setTimestamp()
.footer("Successful Deliveries: " + usersWithRole + " | Failed Deliveries: " + sendingFailed, guild.getIconUrl()).queue(channel);
.footer("Successful Deliveries: " + sendingSuccess + " | Failed Deliveries: " + sendingFailed, guild.getIconUrl()).queue(channel);
}
}