Compare commits

..

No commits in common. "748c5f76b69089b4b20d8edc270fb1387ae077d7" and "9c496f4e06d7ad51e8a41426ccaa17143943d19f" have entirely different histories.

10 changed files with 20 additions and 71 deletions

View File

@ -1,23 +0,0 @@
import ConfigControl from '../lib/config/configControl.js';
export default class SixSecond extends plugin {
constructor() {
super({
name: '60s',
dsc: '60api,获取天下事',
event: 'message',
priority: -200,
rule: [
{
reg: '^(#|/)?60s|(#|/)?早报$',
fnc: 'six',
},
],
});
}
async six(e) {
const url = `${ConfigControl.get('60s')?.url}/v2/60s?encoding=image`;
return e.reply(segment.image(url), true);
}
}

View File

@ -117,9 +117,6 @@ export default class FanqiePlugin extends plugin {
* 解析网页链接中的 book_id * 解析网页链接中的 book_id
*/ */
async handleFanqieLink(e) { async handleFanqieLink(e) {
if (!ConfigControl.get()?.fanqie) {
return;
}
const message = e.msg.trim(); const message = e.msg.trim();
let bookId = null; let bookId = null;
@ -140,9 +137,6 @@ export default class FanqiePlugin extends plugin {
* 使用 #fq下载 命令下载 * 使用 #fq下载 命令下载
*/ */
async downloadByBookId(e) { async downloadByBookId(e) {
if (!ConfigControl.get()?.fanqie) {
return;
}
const bookId = e.msg.replace(/^#?fq下载/, '').trim(); const bookId = e.msg.replace(/^#?fq下载/, '').trim();
return this.downloadFanqieBook(e, bookId); return this.downloadFanqieBook(e, bookId);
} }

View File

@ -2,7 +2,9 @@ import cfg from '../../../lib/config/config.js';
import tool from '../components/tool.js'; import tool from '../components/tool.js';
import axios from 'axios'; import axios from 'axios';
import configControl from '../lib/config/configControl.js'; import configControl from '../lib/config/configControl.js';
import ConfigControl from '../lib/config/configControl.js';
const replyPoke = configControl.get('poke')?.replyPoke;
const nickName = configControl.get('profile')?.nickName;
export default class ChuochuoPlugin extends plugin { export default class ChuochuoPlugin extends plugin {
constructor() { constructor() {
@ -20,10 +22,6 @@ export default class ChuochuoPlugin extends plugin {
} }
async chuoyichuo(e) { async chuoyichuo(e) {
if (!ConfigControl.get()?.poke) {
return;
}
if (cfg.masterQQ.includes(e.target_id) && e.operator_id !== e.target_id) { if (cfg.masterQQ.includes(e.target_id) && e.operator_id !== e.target_id) {
return await pokeMaster(e); return await pokeMaster(e);
} }
@ -62,8 +60,6 @@ async function masterPoke(e) {
async function handleBotPoke(e) { async function handleBotPoke(e) {
try { try {
const replyPoke = configControl.get('poke')?.replyPoke;
const nickName = configControl.get('profile')?.nickName;
const coreUrl = configControl.get(`coreConfig`)?.coreUrl; const coreUrl = configControl.get(`coreConfig`)?.coreUrl;
const targetUrl = `${coreUrl}/api/words/getText`; const targetUrl = `${coreUrl}/api/words/getText`;
const res = await axios.post(targetUrl, { const res = await axios.post(targetUrl, {

View File

@ -6,7 +6,6 @@ import fs from 'fs';
import rssCache from '../lib/rss/rssCache.js'; import rssCache from '../lib/rss/rssCache.js';
import schedule from 'node-schedule'; import schedule from 'node-schedule';
import tools from '../components/tool.js'; import tools from '../components/tool.js';
import ConfigControl from '../lib/config/configControl.js';
export default class RssPlugin extends plugin { export default class RssPlugin extends plugin {
constructor() { constructor() {
@ -40,10 +39,8 @@ export default class RssPlugin extends plugin {
], ],
}); });
if (!global.__rss_job_scheduled) { if (!global.__rss_job_scheduled) {
if (ConfigControl.get()?.rss) { schedule.scheduleJob('*/10 * * * *', () => this.pushFeeds());
schedule.scheduleJob('*/10 * * * *', () => this.pushFeeds()); global.__rss_job_scheduled = true;
global.__rss_job_scheduled = true;
}
} }
} }
@ -79,9 +76,6 @@ export default class RssPlugin extends plugin {
*/ */
async autoAddFeed(e) { async autoAddFeed(e) {
//if (/^#rss/i.test(e.msg.trim())) return false; //if (/^#rss/i.test(e.msg.trim())) return false;
if (!ConfigControl.get()?.rss) {
return;
}
const url = e.msg.match(/(https?:\/\/\S+(?:\.atom|\/feed))/i)?.[1]; const url = e.msg.match(/(https?:\/\/\S+(?:\.atom|\/feed))/i)?.[1];
if (!url) return false; if (!url) return false;
e.msg = `#rss添加 ${url}`; e.msg = `#rss添加 ${url}`;

View File

@ -13,7 +13,6 @@ import {
} from '../constants/zwa/wordlist.js'; } from '../constants/zwa/wordlist.js';
import configControl from '../lib/config/configControl.js'; import configControl from '../lib/config/configControl.js';
import axios from 'axios'; import axios from 'axios';
import ConfigControl from '../lib/config/configControl.js';
const path = process.cwd(); const path = process.cwd();
const getCurrentHour = () => new Date().getHours(); const getCurrentHour = () => new Date().getHours();
@ -45,9 +44,6 @@ export class ZWA extends plugin {
} }
async www(e) { async www(e) {
if (!ConfigControl.get()?.zwa) {
return;
}
const currentHour = getCurrentHour(); const currentHour = getCurrentHour();
if (currentHour >= 20 && currentHour <= 23) { if (currentHour >= 20 && currentHour <= 23) {
if (e.isMaster) { if (e.isMaster) {
@ -108,11 +104,6 @@ export class ZWA extends plugin {
} }
async zzz(e) { async zzz(e) {
logger.info(ConfigControl.get());
if (!ConfigControl.get()?.zwa) {
return;
}
const currentHour = getCurrentHour(); const currentHour = getCurrentHour();
if (currentHour >= 0 && currentHour <= 4) { if (currentHour >= 0 && currentHour <= 4) {
let text_number = Math.ceil(Math.random() * word4_list['length']); let text_number = Math.ceil(Math.random() * word4_list['length']);
@ -158,9 +149,6 @@ export class ZWA extends plugin {
} }
} }
async wuan(e) { async wuan(e) {
if (!ConfigControl.get()?.zwa) {
return;
}
if (e.isMaster) { if (e.isMaster) {
setTimeout(async () => { setTimeout(async () => {
e.reply(['主人中午好好休息哦', segment.image(wa)], true); e.reply(['主人中午好好休息哦', segment.image(wa)], true);

View File

@ -1,3 +0,0 @@
{
"url": "https://60s.crystelf.top"
}

View File

@ -9,9 +9,16 @@
"checkChat": { "checkChat": {
"rdNum": 2, "rdNum": 2,
"masterReply": true, "masterReply": true,
"userId": [], "userId": [
"blackGroups": [], 114514
"enableGroups": [] ],
"blackGroups": [
114,
514
],
"enableGroups": [
11115
]
}, },
"maxMessageLength": 100 "maxMessageLength": 100
} }

View File

@ -2,12 +2,5 @@
"debug": true, "debug": true,
"core": true, "core": true,
"maxFeed": 10, "maxFeed": 10,
"adapter": "lgr", "adapter": "lgr"
"poke": true,
"60s": true,
"fanqie": true,
"zwa": true,
"rss": true,
"help": true,
"welcome": true
} }

View File

@ -1,4 +1,4 @@
{ {
"coreUrl": "https://core.crystelf.top", "coreUrl": "",
"token": "" "token": ""
} }

View File

@ -69,6 +69,9 @@ async function init() {
logger.warn(`[crystelf-plugin] 读取配置文件 ${file} 失败:`, e); logger.warn(`[crystelf-plugin] 读取配置文件 ${file} 失败:`, e);
} }
} }
if (!Array.isArray(configCache)) {
configCache = fc.mergeConfig(configCache, configCache.config || {});
}
if (configCache.debug) { if (configCache.debug) {
logger.info('[crystelf-plugin] 配置模块初始化成功..'); logger.info('[crystelf-plugin] 配置模块初始化成功..');
} }