2023-04-26 03:03:12 +00:00
|
|
|
from core.builtins import Url, Bot
|
2021-11-12 14:25:53 +00:00
|
|
|
from core.dirty_check import check
|
|
|
|
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-04-26 03:03:12 +00:00
|
|
|
async def ab(msg: Bot.MessageSession, wiki_url):
|
2021-11-12 14:25:53 +00:00
|
|
|
wiki = WikiLib(wiki_url)
|
|
|
|
query = await wiki.get_json(action='query', list='abuselog', aflprop='user|title|action|result|filter|timestamp')
|
|
|
|
pageurl = wiki.wiki_info.articlepath.replace('$1', 'Special:AbuseLog')
|
|
|
|
d = []
|
|
|
|
for x in query['query']['abuselog'][:5]:
|
2023-01-16 07:54:07 +00:00
|
|
|
if 'title' in x:
|
2023-05-19 04:46:29 +00:00
|
|
|
d.append(msg.locale.t("wiki.message.ab.slice", title=x['title'], user=x['user'],
|
2023-04-26 03:03:12 +00:00
|
|
|
time=UTC8(x['timestamp'], 'onlytimenoutc'),
|
|
|
|
filter_name=x['filter'], result=x['result']))
|
2021-11-12 14:25:53 +00:00
|
|
|
y = await check(*d)
|
|
|
|
y = '\n'.join(z['content'] for z in y)
|
|
|
|
if y.find('<吃掉了>') != -1 or y.find('<全部吃掉了>') != -1:
|
2023-05-21 04:35:25 +00:00
|
|
|
return f'{str(Url(pageurl))}\n{y}\n{msg.locale.t("wiki.message.utils.only_last_5")}\n{msg.locale.t("wiki.message.utils.banned")}'
|
2021-11-12 14:25:53 +00:00
|
|
|
else:
|
2023-05-21 03:48:33 +00:00
|
|
|
return f'{str(Url(pageurl))}\n{y}\n' + msg.locale.t("wiki.message.utils.only_last_5")
|