Initial Commit
This commit is contained in:
26
src/main/java/com/fpghoti/biscuit/timer/BiscuitTimer.java
Normal file
26
src/main/java/com/fpghoti/biscuit/timer/BiscuitTimer.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package com.fpghoti.biscuit.timer;
|
||||
|
||||
import java.util.TimerTask;
|
||||
|
||||
public abstract class BiscuitTimer extends TimerTask{
|
||||
|
||||
protected Long delay;
|
||||
protected Long period;
|
||||
|
||||
public long getDelay() {
|
||||
if(delay != null) {
|
||||
return delay;
|
||||
}else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public long getPeriod() {
|
||||
if(period != null) {
|
||||
return period;
|
||||
}else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.fpghoti.biscuit.timer.task;
|
||||
|
||||
import com.fpghoti.biscuit.global.MessageQueue;
|
||||
import com.fpghoti.biscuit.timer.BiscuitTimer;
|
||||
|
||||
import net.dv8tion.jda.api.exceptions.ErrorResponseException;
|
||||
|
||||
public class BotMsgRemoveTimer extends BiscuitTimer{
|
||||
|
||||
public BotMsgRemoveTimer(){
|
||||
delay = (long) 0;
|
||||
period = (long) 5*1000;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
for(String m : MessageQueue.removemessages.keySet()){
|
||||
try{
|
||||
MessageQueue.removemessages.get(m).deleteMessageById(m).complete();
|
||||
}catch(ErrorResponseException ex){
|
||||
}
|
||||
}
|
||||
|
||||
MessageQueue.removemessages.clear();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.fpghoti.biscuit.timer.task;
|
||||
|
||||
import com.fpghoti.biscuit.global.MessageQueue;
|
||||
import com.fpghoti.biscuit.timer.BiscuitTimer;
|
||||
|
||||
public class ChatCountTimer extends BiscuitTimer {
|
||||
|
||||
public ChatCountTimer(){
|
||||
delay = (long) 0;
|
||||
period = (long) 10*1000;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
MessageQueue.chatssent.clear();
|
||||
MessageQueue.spammsgs.clear();
|
||||
MessageQueue.chatssent10s.clear();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.fpghoti.biscuit.timer.task;
|
||||
|
||||
import com.fpghoti.biscuit.global.MessageQueue;
|
||||
import com.fpghoti.biscuit.timer.BiscuitTimer;
|
||||
|
||||
import net.dv8tion.jda.api.exceptions.ErrorResponseException;
|
||||
|
||||
public class FastMsgRemoveTimer extends BiscuitTimer{
|
||||
|
||||
public FastMsgRemoveTimer(){
|
||||
delay = (long) 0;
|
||||
period = (long) 1*1000;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
for(String m : MessageQueue.fastremovemessages.keySet()){
|
||||
try{
|
||||
MessageQueue.fastremovemessages.get(m).deleteMessageById(m).complete();
|
||||
}catch(ErrorResponseException ex){
|
||||
}
|
||||
}
|
||||
MessageQueue.fastremovemessages.clear();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.fpghoti.biscuit.timer.task;
|
||||
|
||||
import com.fpghoti.biscuit.global.MessageQueue;
|
||||
import com.fpghoti.biscuit.timer.BiscuitTimer;
|
||||
|
||||
import net.dv8tion.jda.api.exceptions.ErrorResponseException;
|
||||
|
||||
public class SlowMsgRemoveTimer extends BiscuitTimer{
|
||||
|
||||
public SlowMsgRemoveTimer(){
|
||||
delay = (long) 0;
|
||||
period = (long) 5*1000;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
for(String m : MessageQueue.slowremovemessages.keySet()){
|
||||
try{
|
||||
MessageQueue.slowremovemessages.get(m).deleteMessageById(m).complete();
|
||||
}catch(ErrorResponseException ex){
|
||||
}
|
||||
}
|
||||
MessageQueue.slowremovemessages.clear();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.fpghoti.biscuit.timer.task;
|
||||
|
||||
import com.fpghoti.biscuit.global.MessageQueue;
|
||||
import com.fpghoti.biscuit.timer.BiscuitTimer;
|
||||
|
||||
public class SoftMuteTimer extends BiscuitTimer{
|
||||
|
||||
public SoftMuteTimer(){
|
||||
delay = (long) 0;
|
||||
period = (long) 120*1000;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
MessageQueue.chatssent2m.clear();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user