diff --git a/apps/query.js b/apps/query.js index fb746ab..d4a2fd5 100644 --- a/apps/query.js +++ b/apps/query.js @@ -1,14 +1,14 @@ // 主库 import { segment } from "oicq"; import fetch from "node-fetch"; -// 配置文件 -import config from "../model/index.js"; // 爬虫库 import puppeteer from "../../../lib/puppeteer/puppeteer.js"; import _ from "lodash"; // http库 import axios from "axios"; import fs from "node:fs"; +// 常量 +import {CAT_LIMIT} from "../utils/constant.js"; export class query extends plugin { constructor() { @@ -64,7 +64,6 @@ export class query extends plugin { }, ], }); - this.catConfig = config.getConfig("query"); } async doctor(e) { @@ -147,13 +146,12 @@ export class query extends plugin { } async cat(e) { - const numb = this.catConfig.count; let images = []; let reqRes = [ - ...(await fetch(`https://shibe.online/api/cats?count=${numb}`).then(data => + ...(await fetch(`https://shibe.online/api/cats?count=${CAT_LIMIT}`).then(data => data.json(), )), - ...(await fetch(`https://api.thecatapi.com/v1/images/search?limit=${numb}`) + ...(await fetch(`https://api.thecatapi.com/v1/images/search?limit=${CAT_LIMIT}`) .then(data => data.json()) .then(json => json.map(item => item.url))), ]; diff --git a/config/query.yaml b/config/query.yaml deleted file mode 100644 index d828526..0000000 --- a/config/query.yaml +++ /dev/null @@ -1,2 +0,0 @@ -# 发送张数 -count: 10 \ No newline at end of file diff --git a/utils/constant.js b/utils/constant.js index b09d731..8e89780 100644 --- a/utils/constant.js +++ b/utils/constant.js @@ -22,4 +22,6 @@ export const douyinTypeMap = { 150: "image", }; -export const TEN_THOUSAND = 10000; \ No newline at end of file +export const TEN_THOUSAND = 10000; + +export const CAT_LIMIT = 10; \ No newline at end of file