refactor : 精简内容

This commit is contained in:
zhiyu1998 2023-03-15 13:26:34 +08:00
parent 63548f599d
commit 1f55f38af0
3 changed files with 7 additions and 9 deletions

View File

@ -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))),
];

View File

@ -1,2 +0,0 @@
# 发送张数
count: 10

View File

@ -23,3 +23,5 @@ export const douyinTypeMap = {
};
export const TEN_THOUSAND = 10000;
export const CAT_LIMIT = 10;