mirror of
https://github.com/Jerryplusy/crystelf-plugin.git
synced 2025-10-14 05:39:18 +00:00
Compare commits
4 Commits
9c496f4e06
...
748c5f76b6
Author | SHA1 | Date | |
---|---|---|---|
748c5f76b6 | |||
4cd4d3e538 | |||
ccb28e8266 | |||
e2d253a7a9 |
23
apps/60s.js
Normal file
23
apps/60s.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
@ -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);
|
||||||
|
3
config/60s.json
Normal file
3
config/60s.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"url": "https://60s.crystelf.top"
|
||||||
|
}
|
@ -9,16 +9,9 @@
|
|||||||
"checkChat": {
|
"checkChat": {
|
||||||
"rdNum": 2,
|
"rdNum": 2,
|
||||||
"masterReply": true,
|
"masterReply": true,
|
||||||
"userId": [
|
"userId": [],
|
||||||
114514
|
"blackGroups": [],
|
||||||
],
|
"enableGroups": []
|
||||||
"blackGroups": [
|
|
||||||
114,
|
|
||||||
514
|
|
||||||
],
|
|
||||||
"enableGroups": [
|
|
||||||
11115
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"maxMessageLength": 100
|
"maxMessageLength": 100
|
||||||
}
|
}
|
||||||
|
@ -2,5 +2,12 @@
|
|||||||
"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
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"coreUrl": "",
|
"coreUrl": "https://core.crystelf.top",
|
||||||
"token": ""
|
"token": ""
|
||||||
}
|
}
|
||||||
|
@ -69,9 +69,6 @@ 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] 配置模块初始化成功..');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user