Minor bug fix
This commit is contained in:
parent
4b443a1a6c
commit
5dc66effca
|
@ -3,7 +3,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.fpghoti</groupId>
|
||||
<artifactId>Biscuit</artifactId>
|
||||
<version>1.6</version>
|
||||
<version>1.6.1</version>
|
||||
<build>
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
<resources>
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -5,7 +5,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.fpghoti</groupId>
|
||||
<artifactId>Biscuit</artifactId>
|
||||
<version>1.6</version>
|
||||
<version>1.6.1</version>
|
||||
<build>
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
<resources>
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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() + "``");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue