新增模块名字
新番列表模块支持其他群了 定时器支持多个群了
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
package com.yutou.qqbot.utlis;
|
||||
|
||||
import com.yutou.qqbot.QQBotManager;
|
||||
import com.yutou.qqbot.QQNumberManager;
|
||||
import com.yutou.qqbot.models.Model;
|
||||
import net.mamoe.mirai.Bot;
|
||||
import net.mamoe.mirai.contact.Group;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -27,8 +31,13 @@ public class ApplicationInit implements ApplicationRunner {
|
||||
for (Class<?> model : Model.classList) {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
Bot bot = QQBotManager.getInstance().getBot();
|
||||
Model useModel = (Model) model.getDeclaredConstructor().newInstance();
|
||||
useModel.onTime(time);
|
||||
for (Group group : bot.getGroups()) {
|
||||
if(QQNumberManager.getManager().isUseModel(group.getId(),model)){
|
||||
useModel.onTime(group.getId(),time);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user