|
@@ -1,3 +1,4 @@
|
|
|
|
+
|
|
import botlogger from "./logger.js";
|
|
import botlogger from "./logger.js";
|
|
import {promises as fsPromises} from 'fs';
|
|
import {promises as fsPromises} from 'fs';
|
|
import {HtmlImg} from "./Puppeteer.js";
|
|
import {HtmlImg} from "./Puppeteer.js";
|
|
@@ -18,7 +19,7 @@ import {
|
|
import * as fs from 'fs'
|
|
import * as fs from 'fs'
|
|
import * as path from 'path'
|
|
import * as path from 'path'
|
|
// 获取指令前缀
|
|
// 获取指令前缀
|
|
-import {Botconfig as config, PermissionConfig} from './config.js'
|
|
|
|
|
|
+import {Botconfig as config, load, PermissionConfig, saveConfig} from './config.js'
|
|
import {ImageSegment, ReplySegment, TextSegment} from "node-napcat-ts/dist/Structs.js";
|
|
import {ImageSegment, ReplySegment, TextSegment} from "node-napcat-ts/dist/Structs.js";
|
|
import {fileURLToPath} from 'node:url';
|
|
import {fileURLToPath} from 'node:url';
|
|
import {qqBot} from "../app.js";
|
|
import {qqBot} from "../app.js";
|
|
@@ -85,6 +86,7 @@ function findCommand(plugin: Plugin, cmdName: string): Command | undefined {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
// 添加插件加载函数
|
|
// 添加插件加载函数
|
|
async function loadPlugins(): Promise<void> {
|
|
async function loadPlugins(): Promise<void> {
|
|
try {
|
|
try {
|
|
@@ -182,6 +184,7 @@ async function initializeScheduledTasks(instance: any): Promise<void> {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
// 修改 runplugins 函数
|
|
// 修改 runplugins 函数
|
|
export async function runplugins() {
|
|
export async function runplugins() {
|
|
try {
|
|
try {
|
|
@@ -224,6 +227,16 @@ export async function runplugins() {
|
|
type: 'text',
|
|
type: 'text',
|
|
data: {text: `插件下载完成,开始重载`}
|
|
data: {text: `插件下载完成,开始重载`}
|
|
}]);
|
|
}]);
|
|
|
|
+ let isload = load
|
|
|
|
+ isload.isuplad=true;
|
|
|
|
+ isload.name=file.file
|
|
|
|
+ if((context.message_type === 'group')){
|
|
|
|
+ isload.id = context.group_id
|
|
|
|
+ }else{
|
|
|
|
+ isload.id = context.sender.user_id
|
|
|
|
+ }
|
|
|
|
+ isload.isGroupMessage = (context.message_type === 'group');
|
|
|
|
+ saveConfig("load", isload)
|
|
}
|
|
}
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -250,7 +263,16 @@ export async function runplugins() {
|
|
type: 'text',
|
|
type: 'text',
|
|
data: {text: `插件下载完成,开始重载`}
|
|
data: {text: `插件下载完成,开始重载`}
|
|
}]);
|
|
}]);
|
|
- return;
|
|
|
|
|
|
+ let isload = load
|
|
|
|
+ isload.isuplad=true;
|
|
|
|
+ isload.name=pluginName
|
|
|
|
+ if((context.message_type === 'group')){
|
|
|
|
+ isload.id = context.group_id
|
|
|
|
+ }else{
|
|
|
|
+ isload.id = context.sender.user_id
|
|
|
|
+ }
|
|
|
|
+ isload.isGroupMessage = (context.message_type === 'group');
|
|
|
|
+ saveConfig("load", isload)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|