mirror of
https://github.com/LamGC/ContentGrabbingJi.git
synced 2025-04-30 06:37:36 +00:00
Merge branch 'master' into add-framework-interface
This commit is contained in:
commit
b754559187
@ -14,11 +14,15 @@ import net.lz1998.cq.robot.CoolQ;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class CQPluginMain extends CQPlugin implements EventHandler {
|
public class CQPluginMain extends CQPlugin implements EventHandler {
|
||||||
|
|
||||||
|
private final static AtomicBoolean initialState = new AtomicBoolean();
|
||||||
|
|
||||||
public CQPluginMain() {
|
public CQPluginMain() {
|
||||||
ApplicationBoot.initialBot();
|
|
||||||
LoggerFactory.getLogger(CQPluginMain.class)
|
LoggerFactory.getLogger(CQPluginMain.class)
|
||||||
.info("BotEventHandler.COMMAND_PREFIX = {}", BotEventHandler.COMMAND_PREFIX);
|
.info("BotEventHandler.COMMAND_PREFIX = {}", BotEventHandler.COMMAND_PREFIX);
|
||||||
}
|
}
|
||||||
@ -46,6 +50,12 @@ public class CQPluginMain extends CQPlugin implements EventHandler {
|
|||||||
*/
|
*/
|
||||||
private static int processMessage(CoolQ cq, CQMessageEvent event) {
|
private static int processMessage(CoolQ cq, CQMessageEvent event) {
|
||||||
SpringCQMessageSenderFactory.setCoolQ(cq);
|
SpringCQMessageSenderFactory.setCoolQ(cq);
|
||||||
|
synchronized (initialState) {
|
||||||
|
if(!initialState.get()) {
|
||||||
|
ApplicationBoot.initialBot();
|
||||||
|
initialState.set(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
if(BotEventHandler.mismatch(event.getMessage())) {
|
if(BotEventHandler.mismatch(event.getMessage())) {
|
||||||
return MESSAGE_IGNORE;
|
return MESSAGE_IGNORE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user