mirror of
https://github.com/Jerryplusy/crystelf-plugin.git
synced 2025-12-05 15:41:56 +00:00
feat:添加功能开关
This commit is contained in:
parent
e2d253a7a9
commit
ccb28e8266
@ -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);
|
||||
}
|
||||
|
||||
10
apps/poke.js
10
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, {
|
||||
|
||||
@ -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,10 +40,12 @@ export default class RssPlugin extends plugin {
|
||||
],
|
||||
});
|
||||
if (!global.__rss_job_scheduled) {
|
||||
if (ConfigControl.get()?.rss) {
|
||||
schedule.scheduleJob('*/10 * * * *', () => this.pushFeeds());
|
||||
global.__rss_job_scheduled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加rss
|
||||
@ -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}`;
|
||||
|
||||
12
apps/zwa.js
12
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);
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
{
|
||||
"debug": true,
|
||||
"core": true,
|
||||
"poke": true,
|
||||
"60s": true,
|
||||
"fanqie": true,
|
||||
"zwa": true,
|
||||
"rss": true,
|
||||
"help": true,
|
||||
"welcome": true,
|
||||
"maxFeed": 10
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user