Skip to content

Commit

Permalink
fix: 优化代码格式和风格
Browse files Browse the repository at this point in the history
- 调整代码缩进和空格,提高可读性
- 移除多余的分号和括号,统一代码风格
- 简化部分代码结构,提高代码清晰度
  • Loading branch information
MapleLeaf2007 committed Nov 22, 2024
1 parent 0f96db4 commit c53b273
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/apps/TheFilmAndTelevision.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { karin, common, segment } from 'node-karin'
export const magnetSearch = karin.command(/^#?搜影视\\s*(\\S+)$/,
async (e) => await TheFilmAndTelevision(e), {
async (e) => await TheFilmAndTelevision(e), {
priority: 9999,
log: true,
name: '搜影视',
permission: 'all',
})
async function TheFilmAndTelevision(e:any) {
})
async function TheFilmAndTelevision (e:any) {
const match = e.msg.match(/^#?搜影视\s*(\\S+)$/)
const keyword = match ? match[1] : null

Expand All @@ -17,11 +17,11 @@ async function TheFilmAndTelevision(e:any) {
try {
const results = await searchResources(keyword)
if (results.length > 0) {
const forward = results.map((row:any) =>
segment.text(`名称: ${row.title}\n文件大小: ${row.size}\n下载链接: ${row.link}`)
);
const forward = results.map((row:any) =>
segment.text(`名称: ${row.title}\n文件大小: ${row.size}\n下载链接: ${row.link}`)
)
const msg = common.makeForward(forward, e.self_id, e.bot.account.name)
await e.bot.sendForwardMessage(e.contact, msg);
await e.bot.sendForwardMessage(e.contact, msg)
} else {
await e.reply('未找到匹配的结果。', true)
}
Expand All @@ -30,7 +30,7 @@ async function TheFilmAndTelevision(e:any) {
}
}

async function searchResources(keyword: string) {
async function searchResources (keyword: string) {
const apiUrl = `https://ysxjjkl.souyisou.top/api_searchtxt.php?name=${encodeURIComponent(keyword)}`

try {
Expand Down Expand Up @@ -62,4 +62,4 @@ async function searchResources(keyword: string) {
console.error('请求出错:', error)
throw new Error('资源搜索失败')
}
}
}

0 comments on commit c53b273

Please sign in to comment.