From 07a7e41f72cfa9dfd207a04445f4aa5b0b6fa3ce Mon Sep 17 00:00:00 2001 From: Lint Action Date: Tue, 4 May 2021 06:09:42 +0000 Subject: =?UTF-8?q?:rotating=5Flight:=20=E8=87=AA=E5=8A=A8=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ATRI/plugins/github.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'ATRI/plugins/github.py') diff --git a/ATRI/plugins/github.py b/ATRI/plugins/github.py index c238b69..e7c0d80 100644 --- a/ATRI/plugins/github.py +++ b/ATRI/plugins/github.py @@ -12,6 +12,7 @@ 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) @@ -19,21 +20,19 @@ 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: return - + data = json.loads(data) msg0 = ( f"{repo}: #{issue_number} {data['state']}\n" -- cgit v1.2.3