From 6df0e824207eeeb1fe99d44af5677e10ad86a93f Mon Sep 17 00:00:00 2001 From: adk23333 <2633103794@qq.com> Date: Thu, 21 Dec 2023 00:21:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96webhook=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server.py b/server.py index cfa54fd..96a021a 100644 --- a/server.py +++ b/server.py @@ -69,25 +69,25 @@ async def receive(rqt: Request): match (rqt.headers['X-Gitea-Event']): case GiteaEvent.issues.value: data = WebHookIssue(**rqt.json) + rsp_sender = f"{data.sender.username}" rsp_title = f"[{data.repository.full_name}][{data.action}] {data.issue.title} (Issue #{data.issue.id})" - rsp_sender = f"By {data.sender.username}" rsp_ctx = f"{data.issue.body}" rsp_link = f"View it: {data.issue.html_url}" cancel_subscribe = f"unsubscribe: {data.repository.html_url}" - rsp = f"{rsp_title}\n\n{rsp_sender}\n------\n{rsp_ctx}\n------\n{rsp_link}\n{cancel_subscribe}" + rsp = f"{rsp_sender}\n{rsp_title}\n------\n{rsp_ctx}\n------\n{rsp_link}\n{cancel_subscribe}" case GiteaEvent.issue_comment.value: data = WebHookIssueComment(**rqt.json) + rsp_sender = f"{data.sender.username}" rsp_title = f"Re:[{data.repository.full_name}][{data.action}] {data.issue.title} (Issue #{data.issue.id})" - rsp_sender = f"By {data.sender.username}" rsp_ctx = f"{data.comment.body}" rsp_link = f"View it: {data.comment.html_url}" cancel_subscribe = f"unsubscribe: {data.repository.html_url}" - rsp = f"{rsp_title}\n\n{rsp_sender}\n------\n{rsp_ctx}\n------\n{rsp_link}\n{cancel_subscribe}" + rsp = f"{rsp_sender}\n{rsp_title}\n------\n{rsp_ctx}\n------\n{rsp_link}\n{cancel_subscribe}" case _: rsp = "Unknown webhook type! Please contact the administrator."