Archived
1
0
Fork 0
This commit is contained in:
Dianliang233 2021-04-17 22:23:28 +08:00
parent e835365227
commit e55b52d19b
2 changed files with 8 additions and 4 deletions

View file

@ -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())

View file

@ -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(' ')