diff --git a/legacy_subbot.py b/legacy_subbot.py index 794e157a..e0280b1a 100644 --- a/legacy_subbot.py +++ b/legacy_subbot.py @@ -12,7 +12,7 @@ from modules.utils.UTC8 import UTC8 async def newbie(app): logger_info('Subbot newbie launched') - url = 'https://minecraft-zh.gamepedia.com/api.php?action=query&list=logevents&letype=newusers&format=json' + url = 'https://minecraft.fandom.com/zh/api.php?action=query&list=logevents&letype=newusers&format=json' while True: try: file = await get_data(url, 'json') @@ -31,7 +31,7 @@ async def newbie(app): if s.find("<吃掉了>") != -1 or s.find("<全部吃掉了>") != -1: await app.sendGroupMessage(731397727, MessageChain.create( [Plain( - s + '\n检测到外来信息介入,请前往日志查看所有消息。https://minecraft-zh.gamepedia.com/Special:%E6%97%A5%E5%BF%97?type=newusers')]).asSendable()) + s + '\n检测到外来信息介入,请前往日志查看所有消息。https://minecraft.fandom.com/zh/wiki/Special:%E6%97%A5%E5%BF%97?type=newusers')]).asSendable()) else: await app.sendGroupMessage(731397727, MessageChain.create([Plain(s)]).asSendable()) diff --git a/modules/github/__init__.py b/modules/github/__init__.py index 4a92ba96..aac0a533 100644 --- a/modules/github/__init__.py +++ b/modules/github/__init__.py @@ -70,6 +70,10 @@ async def repo(kwargs: dict, cmd: list): except IndexError: obj = cmd[0].replace('@', '') result = await query('https://api.github.com/repos/' + obj, 'json') + if 'message' in result and result['message'] == 'Not Found': + raise RuntimeError('此仓库不存在。') + elif 'message' in result and result['message']: + raise RuntimeError(result['message']) name = result['full_name'] url = result['html_url'] rid = result['id'] @@ -79,7 +83,7 @@ async def repo(kwargs: dict, cmd: list): watch = result['watchers_count'] mirror = result['mirror_url'] rlicense = 'Unknown' - if 'license' in result: + if 'license' in result and result['license'] is not None: if 'spdx_id' in result['license']: rlicense = result['license']['spdx_id'] is_fork = result['fork'] @@ -130,6 +134,7 @@ Created {time_diff(created)} ago | Updated {time_diff(updated)} ago await sendMessage(kwargs, MessageChain.create([Plain(msg)])) except Exception as e: await sendMessage(kwargs, '发生错误:' + str(e)) + traceback.print_exc() async def user(kwargs: dict, cmd: list): @@ -231,7 +236,6 @@ async def search(kwargs: dict, cmd: list): except Exception as error: await sendMessage(kwargs, '发生错误:' + str(error)) - async def forker(kwargs: dict): cmd = kwargs['trigger_msg'] cmd = re.sub(r'^github ', '', cmd).split(' ')