diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml
index d1ce4e9..d8ed111 100644
--- a/dependency-reduced-pom.xml
+++ b/dependency-reduced-pom.xml
@@ -3,7 +3,7 @@
4.0.0
com.fpghoti
Biscuit
- 1.6
+ 1.6.1
src/main/java
diff --git a/pom.xml b/pom.xml
index 037d2c5..686d483 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
4.0.0
com.fpghoti
Biscuit
- 1.6
+ 1.6.1
src/main/java
diff --git a/src/main/java/com/fpghoti/biscuit/Main.java b/src/main/java/com/fpghoti/biscuit/Main.java
index f600a79..90a43f0 100644
--- a/src/main/java/com/fpghoti/biscuit/Main.java
+++ b/src/main/java/com/fpghoti/biscuit/Main.java
@@ -38,6 +38,7 @@ import com.fpghoti.biscuit.commands.console.ShutdownConsoleCommand;
import com.fpghoti.biscuit.listener.DMListener;
import com.fpghoti.biscuit.listener.GuildListener;
import com.fpghoti.biscuit.listener.JoinListener;
+import com.fpghoti.biscuit.listener.LeaveListener;
import com.fpghoti.biscuit.listener.MessageDeleteListener;
import com.fpghoti.biscuit.listener.MessageEditListener;
import com.fpghoti.biscuit.listener.MessageReceiveListener;
@@ -93,6 +94,7 @@ public class Main {
jda.addEventListener(new MessageEditListener());
jda.addEventListener(new MessageDeleteListener());
jda.addEventListener(new JoinListener());
+ jda.addEventListener(new LeaveListener());
jda.addEventListener(new DMListener());
jda.addEventListener(new ReactionListener());
jda.addEventListener(new RoleListener());
diff --git a/src/main/java/com/fpghoti/biscuit/listener/LeaveListener.java b/src/main/java/com/fpghoti/biscuit/listener/LeaveListener.java
new file mode 100644
index 0000000..d6cd961
--- /dev/null
+++ b/src/main/java/com/fpghoti/biscuit/listener/LeaveListener.java
@@ -0,0 +1,26 @@
+package com.fpghoti.biscuit.listener;
+
+import com.fpghoti.biscuit.biscuit.Biscuit;
+import com.fpghoti.biscuit.logging.BColor;
+import com.fpghoti.biscuit.user.PreUser;
+
+import net.dv8tion.jda.api.entities.User;
+import net.dv8tion.jda.api.events.guild.member.GuildMemberRemoveEvent;
+import net.dv8tion.jda.api.hooks.ListenerAdapter;
+
+public class LeaveListener extends ListenerAdapter {
+
+ @Override
+ public void onGuildMemberRemove(GuildMemberRemoveEvent event) {
+ Biscuit biscuit = Biscuit.getBiscuit(event.getGuild());
+ User user = event.getMember().getUser();
+ PreUser u = biscuit.getPreUser(user);
+ int time = u.getTimeLeft();
+ u.remove();
+ if(time > 0) {
+ biscuit.log(BColor.YELLOW + "USER LEFT: " + user.getName() + " " + user.getAsMention());
+ biscuit.captchaLog("**User Left: ** ``" + user.getName() + "`` " + user.getAsMention() + "``");
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/fpghoti/biscuit/listener/MessageReceiveListener.java b/src/main/java/com/fpghoti/biscuit/listener/MessageReceiveListener.java
index 4de1aa3..4f164b0 100644
--- a/src/main/java/com/fpghoti/biscuit/listener/MessageReceiveListener.java
+++ b/src/main/java/com/fpghoti/biscuit/listener/MessageReceiveListener.java
@@ -11,6 +11,7 @@ import com.fpghoti.biscuit.util.PermUtil;
import com.fpghoti.biscuit.util.Util;
import net.dv8tion.jda.api.entities.ChannelType;
import net.dv8tion.jda.api.entities.Message;
+import net.dv8tion.jda.api.entities.Message.Attachment;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
@@ -56,7 +57,20 @@ public class MessageReceiveListener extends ListenerAdapter{
biscuit.log("[" + BColor.CYAN_BOLD + "MSG" + BColor.RESET + "] " + BColor.GREEN + "ID: " + BColor.RESET +
event.getMessageId() + BColor.GREEN + " Sender: " + BColor.RESET + event.getAuthor().getAsMention() +
BColor.GREEN + " Channel: " + BColor.RESET + event.getChannel().getName());
- biscuit.log(BColor.GREEN_BOLD + event.getAuthor().getName() + ": " + BColor.WHITE_BOLD + event.getMessage().getContentDisplay());
+ String msg = event.getMessage().getContentDisplay();
+
+ if(event.getMessage().getAttachments().size() >= 1) {
+ String tail = BColor.CYAN + "[ATTACHMENT(S)]: ";
+ if(!msg.equals("")) {
+ msg = msg + " ";
+ }
+ for(Attachment a : event.getMessage().getAttachments()) {
+ tail = tail + msg + " " + a.getUrl();
+ }
+ msg = msg + tail;
+ }
+
+ biscuit.log(BColor.GREEN_BOLD + event.getAuthor().getName() + ": " + BColor.WHITE_BOLD + msg);
}
}
}
diff --git a/src/main/java/com/fpghoti/biscuit/user/PreUser.java b/src/main/java/com/fpghoti/biscuit/user/PreUser.java
index 3e719a4..8e049f9 100644
--- a/src/main/java/com/fpghoti/biscuit/user/PreUser.java
+++ b/src/main/java/com/fpghoti/biscuit/user/PreUser.java
@@ -75,6 +75,10 @@ public class PreUser {
public void setDone() {
this.done = true;
}
+
+ public int getTimeLeft() {
+ return timeLeft;
+ }
public void decrementTime() {
if(!shareGuild()) {
@@ -94,7 +98,7 @@ public class PreUser {
biscuit.log(user.getName() + " " + user.getAsMention() + " waited too long to complete the captcha. Kicking...");
biscuit.captchaLog("``" + user.getName() +"`` " + user.getAsMention() + " waited too long to complete the captcha! Kicking...");
- if(biscuit.getGuild().getMember(user).getRoles().size() == 1 && PermUtil.hasDefaultRole(m) && !PermUtil.hasRewardRole(m)) {
+ if(m != null && m.getRoles().size() == 1 && PermUtil.hasDefaultRole(m) && !PermUtil.hasRewardRole(m)) {
biscuit.getGuild().kick(user.getId()).queue();
}