Archived
1
0
Fork 0
This repository has been archived on 2024-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
akari-bot/rc/__init__.py

19 lines
812 B
Python
Raw Normal View History

2020-06-13 12:43:43 +00:00
# -*- coding:utf-8 -*-
import json
import requests
2020-07-25 16:44:49 +00:00
from .pbc import main
2020-07-26 01:15:19 +00:00
import re
2020-06-13 12:43:43 +00:00
async def rc():
url = 'https://minecraft-zh.gamepedia.com/api.php?action=query&list=recentchanges&rcprop=title|user|timestamp&rctype=edit|new&format=json'
text1 = requests.get(url,timeout=10)
file = json.loads(text1.text)
2020-07-25 16:44:49 +00:00
d = []
for x in file['query']['recentchanges']:
d.append(x['title']+' - '+x['user']+' '+x['timestamp'])
y = await main(d)
space = '\n'
f = re.findall(r'.*\n.*\n.*\n.*\n.*',space.join(y))
2020-07-28 10:59:22 +00:00
if f[0].find('<吃掉了>')!=-1 or f[0].find('<全部吃掉了>')!=-1:
2020-07-26 01:34:36 +00:00
return(f[0]+'\n...仅显示前5条内容\n检测到外来信息介入请前往最近更改查看所有消息。Special:最近更改')
else:
return(f[0]+'\n...仅显示前5条内容')