From ef57aaa5f7ca2395845ecdedf5343619d17f767a Mon Sep 17 00:00:00 2001 From: ikechan8370 Date: Tue, 9 May 2023 17:37:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20github=E5=8D=A1=E7=89=87=E6=94=AF?= =?UTF-8?q?=E6=8C=81issue=E5=92=8Cpr=20(#47)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/fun.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/fun.js b/apps/fun.js index 42b5c1c..0403132 100644 --- a/apps/fun.js +++ b/apps/fun.js @@ -182,14 +182,16 @@ export class Fun extends plugin { async GH (e) { const api = 'https://opengraph.githubassets.com' - let reg = /github.com\/[a-zA-Z0-9-]{1,39}\/[a-zA-Z0-9_-]{1,100}/ + let reg = /github.com\/[a-zA-Z0-9-]{1,39}\/[a-zA-Z0-9_-]{1,100}(?:\/(?:pull|issue)\/\d+)?/ const isMatched = e.msg.match(reg) const id = 'Yenai' if (isMatched) { - const res = isMatched[0].split('/') - const [user, repo] = [res[1], res[2].split('#')[0]] - e.reply(segment.image(`${api}/${id}/${user}/${repo}`)) + // const res = isMatched[0].split('/') + let path = isMatched[0].replace('github.com/', '') + e.reply(segment.image(`${api}/${id}/${path}`)) + // const [user, repo] = [res[1], res[2].split('#')[0]] + // e.reply(segment.image(`${api}/${id}/${user}/${repo}`)) } }