diff options
author | Kyomotoi <[email protected]> | 2021-07-08 22:09:00 +0800 |
---|---|---|
committer | Kyomotoi <[email protected]> | 2021-07-08 22:09:00 +0800 |
commit | be2747e4d4b820ca0f1f988d3b77a628da26fe7b (patch) | |
tree | e1a59dd79ecd973a7d704568dcdc018f1f1b651a /ATRI/plugins/github.py | |
parent | a4e1b9d1581d756ef79ad063d1c0bd6b2fd13c1d (diff) | |
download | ATRI-be2747e4d4b820ca0f1f988d3b77a628da26fe7b.tar.gz ATRI-be2747e4d4b820ca0f1f988d3b77a628da26fe7b.tar.bz2 ATRI-be2747e4d4b820ca0f1f988d3b77a628da26fe7b.zip |
🔖♻️🐛🔧🔥📝 更新版本:YHN-001-A03
🔖 更新版本至:YHN-001-A03
✨ 新增插件:
- 涩图
- 闲聊(文爱
♻️ 重构:
- Service
- 所有插件
🐛 修复部分小bug
🔧 暂时移除部分设置
🔥 删除:
- 插件:nsfw、wife。日后加回
- 插件 essential 中部分内容
📝 更新README
Diffstat (limited to 'ATRI/plugins/github.py')
-rw-r--r-- | ATRI/plugins/github.py | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/ATRI/plugins/github.py b/ATRI/plugins/github.py deleted file mode 100644 index c8c8f2b..0000000 --- a/ATRI/plugins/github.py +++ /dev/null @@ -1,43 +0,0 @@ -import re -import json -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 RequestError - - -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) - patt = r"https://github.com/(.*)/(.*)/issues/(.*)" - 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) - - try: - data = await get_bytes(url) - except RequestError: - return - - data = json.loads(data) - msg0 = ( - f"{repo}: #{issue_number} {data['state']}\n" - f"comments: {data['comments']}\n" - f"update: {data['updated_at']}\n" - f"{data['body']}" - ) - await github_issues.finish(msg0) |