2021-11-12 14:25:53 +00:00
|
|
|
|
from config import Config
|
|
|
|
|
from core.dirty_check import check
|
2022-08-04 07:52:42 +00:00
|
|
|
|
from core.logger import Logger
|
2021-11-12 14:25:53 +00:00
|
|
|
|
from modules.wiki.utils.UTC8 import UTC8
|
2022-09-06 15:30:39 +00:00
|
|
|
|
from modules.wiki.utils.wikilib import WikiLib
|
2021-11-12 14:25:53 +00:00
|
|
|
|
|
|
|
|
|
|
2023-05-21 04:25:19 +00:00
|
|
|
|
async def ab_qq(wiki_url):
|
2021-11-12 14:25:53 +00:00
|
|
|
|
wiki = WikiLib(wiki_url)
|
|
|
|
|
qq_account = Config("qq_account")
|
|
|
|
|
query = await wiki.get_json(action='query', list='abuselog', aflprop='user|title|action|result|filter|timestamp',
|
|
|
|
|
afllimit=99)
|
|
|
|
|
pageurl = wiki.wiki_info.articlepath.replace("$1", 'Special:AbuseLog')
|
|
|
|
|
nodelist = [{
|
|
|
|
|
"type": "node",
|
|
|
|
|
"data": {
|
2023-05-21 04:25:19 +00:00
|
|
|
|
"name": f"滥用过滤器日志地址",
|
2021-11-12 14:25:53 +00:00
|
|
|
|
"uin": qq_account,
|
|
|
|
|
"content": [
|
2023-05-21 04:57:33 +00:00
|
|
|
|
{"type": "text", "data": {"text": pageurl + ('\n tips:复制粘贴下面的任一消息到聊天窗口发送可获取此次改动详细信息的截图。'
|
2023-01-26 09:28:28 +00:00
|
|
|
|
if wiki.wiki_info.in_allowlist else '')}}]
|
2021-11-12 14:25:53 +00:00
|
|
|
|
}
|
|
|
|
|
}]
|
|
|
|
|
ablist = []
|
|
|
|
|
userlist = []
|
|
|
|
|
titlelist = []
|
|
|
|
|
for x in query["query"]["abuselog"]:
|
2023-01-16 07:54:07 +00:00
|
|
|
|
if 'title' in x:
|
|
|
|
|
userlist.append(x['user'])
|
|
|
|
|
titlelist.append(x['title'])
|
2021-11-12 14:25:53 +00:00
|
|
|
|
checked_userlist = await check(*userlist)
|
|
|
|
|
user_checked_map = {}
|
|
|
|
|
for u in checked_userlist:
|
|
|
|
|
user_checked_map[u['original']] = u['content']
|
|
|
|
|
checked_titlelist = await check(*titlelist)
|
|
|
|
|
title_checked_map = {}
|
|
|
|
|
for t in checked_titlelist:
|
|
|
|
|
title_checked_map[t['original']] = t['content']
|
|
|
|
|
for x in query["query"]["abuselog"]:
|
|
|
|
|
t = []
|
|
|
|
|
t.append(f"用户:{user_checked_map[x['user']]}")
|
|
|
|
|
t.append(f"页面标题:{title_checked_map[x['title']]}")
|
2022-01-05 11:14:45 +00:00
|
|
|
|
t.append(f"过滤器名:{x['filter']}")
|
2021-11-12 14:25:53 +00:00
|
|
|
|
t.append(f"操作:{x['action']}")
|
|
|
|
|
result = x['result']
|
|
|
|
|
if result == '':
|
|
|
|
|
result = 'pass'
|
|
|
|
|
t.append(f"处理结果:{result}")
|
|
|
|
|
t.append(UTC8(x['timestamp'], 'full'))
|
|
|
|
|
ablist.append('\n'.join(t))
|
|
|
|
|
for x in ablist:
|
|
|
|
|
nodelist.append(
|
|
|
|
|
{
|
|
|
|
|
"type": "node",
|
|
|
|
|
"data": {
|
2023-05-21 04:25:19 +00:00
|
|
|
|
"name": f"滥用过滤器日志",
|
2021-11-12 14:25:53 +00:00
|
|
|
|
"uin": qq_account,
|
|
|
|
|
"content": [{"type": "text", "data": {"text": x}}],
|
|
|
|
|
}
|
|
|
|
|
})
|
2022-08-04 07:52:42 +00:00
|
|
|
|
Logger.debug(nodelist)
|
2021-11-12 14:25:53 +00:00
|
|
|
|
return nodelist
|