diff --git a/apps/fanqie.js b/apps/fanqie.js index 8a213b3..9db093a 100644 --- a/apps/fanqie.js +++ b/apps/fanqie.js @@ -117,6 +117,9 @@ export default class FanqiePlugin extends plugin { * 解析网页链接中的 book_id */ async handleFanqieLink(e) { + if (!ConfigControl.get()?.fanqie) { + return; + } const message = e.msg.trim(); let bookId = null; @@ -137,6 +140,9 @@ export default class FanqiePlugin extends plugin { * 使用 #fq下载 命令下载 */ async downloadByBookId(e) { + if (!ConfigControl.get()?.fanqie) { + return; + } const bookId = e.msg.replace(/^#?fq下载/, '').trim(); return this.downloadFanqieBook(e, bookId); } diff --git a/apps/poke.js b/apps/poke.js index 5ea3e60..61cb6aa 100644 --- a/apps/poke.js +++ b/apps/poke.js @@ -2,9 +2,7 @@ import cfg from '../../../lib/config/config.js'; import tool from '../components/tool.js'; import axios from 'axios'; import configControl from '../lib/config/configControl.js'; - -const replyPoke = configControl.get('poke')?.replyPoke; -const nickName = configControl.get('profile')?.nickName; +import ConfigControl from '../lib/config/configControl.js'; export default class ChuochuoPlugin extends plugin { constructor() { @@ -22,6 +20,10 @@ export default class ChuochuoPlugin extends plugin { } async chuoyichuo(e) { + if (!ConfigControl.get()?.poke) { + return; + } + if (cfg.masterQQ.includes(e.target_id) && e.operator_id !== e.target_id) { return await pokeMaster(e); } @@ -60,6 +62,8 @@ async function masterPoke(e) { async function handleBotPoke(e) { try { + const replyPoke = configControl.get('poke')?.replyPoke; + const nickName = configControl.get('profile')?.nickName; const coreUrl = configControl.get(`coreConfig`)?.coreUrl; const targetUrl = `${coreUrl}/api/words/getText`; const res = await axios.post(targetUrl, { diff --git a/apps/rssPush.js b/apps/rssPush.js index 57e365d..b753a83 100644 --- a/apps/rssPush.js +++ b/apps/rssPush.js @@ -6,6 +6,7 @@ import fs from 'fs'; import rssCache from '../lib/rss/rssCache.js'; import schedule from 'node-schedule'; import tools from '../components/tool.js'; +import ConfigControl from '../lib/config/configControl.js'; export default class RssPlugin extends plugin { constructor() { @@ -39,8 +40,10 @@ export default class RssPlugin extends plugin { ], }); if (!global.__rss_job_scheduled) { - schedule.scheduleJob('*/10 * * * *', () => this.pushFeeds()); - global.__rss_job_scheduled = true; + if (ConfigControl.get()?.rss) { + schedule.scheduleJob('*/10 * * * *', () => this.pushFeeds()); + global.__rss_job_scheduled = true; + } } } @@ -76,6 +79,9 @@ export default class RssPlugin extends plugin { */ async autoAddFeed(e) { //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]; if (!url) return false; e.msg = `#rss添加 ${url}`; diff --git a/apps/zwa.js b/apps/zwa.js index ca1d028..bf2cc21 100644 --- a/apps/zwa.js +++ b/apps/zwa.js @@ -13,6 +13,7 @@ import { } from '../constants/zwa/wordlist.js'; import configControl from '../lib/config/configControl.js'; import axios from 'axios'; +import ConfigControl from '../lib/config/configControl.js'; const path = process.cwd(); const getCurrentHour = () => new Date().getHours(); @@ -44,6 +45,9 @@ export class ZWA extends plugin { } async www(e) { + if (!ConfigControl.get()?.zwa) { + return; + } const currentHour = getCurrentHour(); if (currentHour >= 20 && currentHour <= 23) { if (e.isMaster) { @@ -104,6 +108,11 @@ export class ZWA extends plugin { } async zzz(e) { + logger.info(ConfigControl.get()); + if (!ConfigControl.get()?.zwa) { + return; + } + const currentHour = getCurrentHour(); if (currentHour >= 0 && currentHour <= 4) { let text_number = Math.ceil(Math.random() * word4_list['length']); @@ -149,6 +158,9 @@ export class ZWA extends plugin { } } async wuan(e) { + if (!ConfigControl.get()?.zwa) { + return; + } if (e.isMaster) { setTimeout(async () => { e.reply(['主人中午好好休息哦', segment.image(wa)], true); diff --git a/config/config.json b/config/config.json index 6a44b89..def7cc3 100644 --- a/config/config.json +++ b/config/config.json @@ -1,5 +1,12 @@ { "debug": true, "core": true, + "poke": true, + "60s": true, + "fanqie": true, + "zwa": true, + "rss": true, + "help": true, + "welcome": true, "maxFeed": 10 }