From ea7f48011c34fdaec7e91af7eb373c8174e439e6 Mon Sep 17 00:00:00 2001 From: Kyomotoi <1172294279@qq.com> Date: Tue, 4 May 2021 14:27:56 +0800 Subject: =?UTF-8?q?=E2=9C=A8=F0=9F=90=9B=20=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增:老婆! 新增:涩图 修复:manage中出现的bug 优化:nsfw不再用float,换为int --- ATRI/plugins/github.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'ATRI/plugins/github.py') diff --git a/ATRI/plugins/github.py b/ATRI/plugins/github.py index e7c0d80..27c5328 100644 --- a/ATRI/plugins/github.py +++ b/ATRI/plugins/github.py @@ -4,7 +4,7 @@ from nonebot.adapters.cqhttp import Bot, MessageEvent from ATRI.service import Service as sv from ATRI.utils.request import get_bytes -from ATRI.exceptions import RequestTimeOut +from ATRI.exceptions import RequestError URL = "https://api.github.com/repos/{owner}/{repo}/issues/{issue_number}" @@ -12,7 +12,6 @@ URL = "https://api.github.com/repos/{owner}/{repo}/issues/{issue_number}" github_issues = sv.on_message() - @github_issues.handle() async def _github_issues(bot: Bot, event: MessageEvent) -> None: msg = str(event.message) @@ -20,19 +19,21 @@ async def _github_issues(bot: Bot, event: MessageEvent) -> None: need_info = re.findall(patt, msg) if not need_info: return - + for i in need_info: need_info = list(i) owner = need_info[0] repo = need_info[1] issue_number = need_info[2] - url = URL.format(owner=owner, repo=repo, issue_number=issue_number) - + url = URL.format(owner=owner, + repo=repo, + issue_number=issue_number) + try: data = await get_bytes(url) - except RequestTimeOut: + except RequestError: return - + data = json.loads(data) msg0 = ( f"{repo}: #{issue_number} {data['state']}\n" -- cgit v1.2.3