🐞 fix: 删除不稳定功能#热搜

This commit is contained in:
zhiyu1998 2023-03-22 10:07:38 +08:00
parent e7d87f8dbc
commit c51bc70ef4

View File

@ -28,10 +28,6 @@ export class query extends plugin {
reg: "^#(cat)$",
fnc: "cat",
},
{
reg: "^#热搜(.*)",
fnc: "hotSearch",
},
{
reg: "^#推荐软件$",
fnc: "softwareRecommended",
@ -119,29 +115,6 @@ export class query extends plugin {
return !!(await this.reply(await Bot.makeForwardMsg(images)));
}
async hotSearch(e) {
const platform = e.msg.replace('#热搜', "").trim();
const apiAddr = HOT_SEARCH_ACTIONS?.[platform]
if (_.isEmpty(apiAddr)) {
e.reply('暂时无法查询该平台的热搜');
return true;
}
const hots = await fetch(apiAddr).then(async res => {
const resJson = JSON.parse(await res.text())?.data;
return resJson.map((item, index) => {
const {name, hot, url} = item
const template = `${index+1}. 标题:${name}\n热度:${_.isNaN(hot) ? Number(hot/TEN_THOUSAND).toFixed(1)+"万" : '暂无'}\n链接:${url}`
return {
message: { type: "text", text: template },
nickname: e.sender.card || e.user_id,
user_id: e.user_id
}
})
});
e.reply(await Bot.makeForwardMsg(hots))
return true;
}
async softwareRecommended(e) {
// 接口
const pcUrl = "https://www.ghxi.com/ghapi?type=query&n=pc";