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
|
* 解析网页链接中的 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;
|
||||||
|
|
||||||
@ -137,6 +140,9 @@ 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);
|
||||||
}
|
}
|
||||||
|
|||||||
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 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() {
|
||||||
@ -22,6 +20,10 @@ 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);
|
||||||
}
|
}
|
||||||
@ -60,6 +62,8 @@ 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, {
|
||||||
|
|||||||
@ -6,6 +6,7 @@ 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() {
|
||||||
@ -39,8 +40,10 @@ export default class RssPlugin extends plugin {
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
if (!global.__rss_job_scheduled) {
|
if (!global.__rss_job_scheduled) {
|
||||||
schedule.scheduleJob('*/10 * * * *', () => this.pushFeeds());
|
if (ConfigControl.get()?.rss) {
|
||||||
global.__rss_job_scheduled = true;
|
schedule.scheduleJob('*/10 * * * *', () => this.pushFeeds());
|
||||||
|
global.__rss_job_scheduled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,6 +79,9 @@ 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}`;
|
||||||
|
|||||||
12
apps/zwa.js
12
apps/zwa.js
@ -13,6 +13,7 @@ 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();
|
||||||
@ -44,6 +45,9 @@ 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) {
|
||||||
@ -104,6 +108,11 @@ 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']);
|
||||||
@ -149,6 +158,9 @@ 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);
|
||||||
|
|||||||
@ -1,5 +1,12 @@
|
|||||||
{
|
{
|
||||||
"debug": true,
|
"debug": true,
|
||||||
"core": true,
|
"core": true,
|
||||||
|
"poke": true,
|
||||||
|
"60s": true,
|
||||||
|
"fanqie": true,
|
||||||
|
"zwa": true,
|
||||||
|
"rss": true,
|
||||||
|
"help": true,
|
||||||
|
"welcome": true,
|
||||||
"maxFeed": 10
|
"maxFeed": 10
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user