From 3319ec5464afb94084650afba931ef3adbd93282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E6=AE=87?= <197728340@qq.com> Date: Fri, 22 Nov 2024 14:33:08 +0800 Subject: [PATCH] =?UTF-8?q?style(Cili):=20=E6=A0=BC=E5=BC=8F=E5=8C=96=20Ci?= =?UTF-8?q?li.ts=20=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 调整代码缩进和空格 - 移除多余的分号 - 统一使用模板字符串 - 简化了一些代码结构 --- src/apps/Cili.ts | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/apps/Cili.ts b/src/apps/Cili.ts index 62bfabf..dbe64c7 100644 --- a/src/apps/Cili.ts +++ b/src/apps/Cili.ts @@ -1,50 +1,50 @@ -import { karin, common,segment,logger } from 'node-karin' +import { karin, common, segment, logger } from 'node-karin' export const magnetSearch = karin.command(/^#?磁力搜索\s*(.+)/, async (e) => { - const searchQuery = e.msg.match(/^#?磁力搜索\s*(.+)$/)?.[1]; + const searchQuery = e.msg.match(/^#?磁力搜索\s*(.+)$/)?.[1] if (!searchQuery) { - await e.reply('请输入有效的搜索关键词!', { at: true, recallMsg: 0, reply: true }); - return true; + await e.reply('请输入有效的搜索关键词!', { at: true, recallMsg: 0, reply: true }) + return true } - const url = `https://cili.site/search?q=${encodeURIComponent(searchQuery)}`; + const url = `https://cili.site/search?q=${encodeURIComponent(searchQuery)}` try { - const response = await fetch(url); + const response = await fetch(url) if (!response.ok) { - throw new Error(`请求失败,状态码:${response.status}`); + throw new Error(`请求失败,状态码:${response.status}`) } - const data = await response.text(); - const results: { title: string; size: string; link: string }[] = []; + const data = await response.text() + const results: { title: string; size: string; link: string }[] = [] const regex = - /
([^<]+)<\/p>[\s\S]*?<\/a>[\s\S]*?<\/td>[\s\S]*?
([^<]+)<\/p>[\s\S]*?<\/a>[\s\S]*?<\/td>[\s\S]*?