2022-09-06 15:30:39 +00:00
|
|
|
import traceback
|
|
|
|
|
2023-05-28 09:38:21 +00:00
|
|
|
from core.builtins import Bot
|
2023-03-04 08:51:56 +00:00
|
|
|
from core.component import module
|
2022-09-06 15:30:39 +00:00
|
|
|
from modules.wiki.utils.dbutils import WikiTargetInfo, Audit
|
|
|
|
from modules.wiki.utils.wikilib import WikiLib, WhatAreUDoingError, PageInfo, InvalidWikiError, QueryInfo
|
|
|
|
from .ab import ab
|
|
|
|
from .ab_qq import ab_qq
|
|
|
|
from .newbie import newbie
|
|
|
|
from .rc import rc
|
|
|
|
from .rc_qq import rc_qq
|
|
|
|
|
2023-05-19 04:46:29 +00:00
|
|
|
rc_ = module('rc', desc='{wiki.help.rc.desc}', developers=['OasisAkari'])
|
2022-09-06 15:30:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
@rc_.handle()
|
2023-05-28 09:38:21 +00:00
|
|
|
async def rc_loader(msg: Bot.MessageSession):
|
2022-09-06 15:30:39 +00:00
|
|
|
start_wiki = WikiTargetInfo(msg).get_start_wiki()
|
|
|
|
if start_wiki is None:
|
2023-04-15 06:06:42 +00:00
|
|
|
return await msg.finish(msg.locale.t('wiki.message.not_set'))
|
2022-09-06 15:30:39 +00:00
|
|
|
legacy = True
|
|
|
|
if msg.Feature.forward and msg.target.targetFrom == 'QQ|Group':
|
|
|
|
try:
|
|
|
|
nodelist = await rc_qq(start_wiki)
|
|
|
|
await msg.fake_forward_msg(nodelist)
|
|
|
|
legacy = False
|
|
|
|
except Exception:
|
|
|
|
traceback.print_exc()
|
2023-05-31 15:28:15 +00:00
|
|
|
await msg.sendMessage(msg.locale.t('wiki.message.rollback'))
|
2022-09-06 15:30:39 +00:00
|
|
|
legacy = True
|
|
|
|
if legacy:
|
2023-05-31 15:21:57 +00:00
|
|
|
res = await rc(msg, start_wiki)
|
2022-09-06 15:30:39 +00:00
|
|
|
await msg.finish(res)
|
|
|
|
|
|
|
|
|
2023-05-19 04:46:29 +00:00
|
|
|
a = module('ab', desc='{wiki.help.ab.desc}', developers=['OasisAkari'])
|
2022-09-06 15:30:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
@a.handle()
|
2023-05-28 09:38:21 +00:00
|
|
|
async def ab_loader(msg: Bot.MessageSession):
|
2022-09-06 15:30:39 +00:00
|
|
|
start_wiki = WikiTargetInfo(msg).get_start_wiki()
|
|
|
|
if start_wiki is None:
|
2023-04-15 06:06:42 +00:00
|
|
|
return await msg.finish(msg.locale.t('wiki.message.not_set'))
|
2022-09-06 15:30:39 +00:00
|
|
|
legacy = True
|
|
|
|
if msg.Feature.forward and msg.target.targetFrom == 'QQ|Group':
|
|
|
|
try:
|
|
|
|
nodelist = await ab_qq(start_wiki)
|
|
|
|
await msg.fake_forward_msg(nodelist)
|
|
|
|
legacy = False
|
|
|
|
except Exception:
|
|
|
|
traceback.print_exc()
|
2023-05-31 15:28:15 +00:00
|
|
|
await msg.sendMessage(msg.locale.t('wiki.message.rollback'))
|
2022-09-06 15:30:39 +00:00
|
|
|
legacy = True
|
|
|
|
if legacy:
|
2023-04-26 03:03:12 +00:00
|
|
|
res = await ab(msg, start_wiki)
|
2022-09-06 15:30:39 +00:00
|
|
|
await msg.finish(res)
|
|
|
|
|
|
|
|
|
2023-05-19 04:46:29 +00:00
|
|
|
n = module('newbie', desc='{wiki.help.newbie.desc}', developers=['OasisAkari'])
|
2022-09-06 15:30:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
@n.handle()
|
2023-05-28 09:38:21 +00:00
|
|
|
async def newbie_loader(msg: Bot.MessageSession):
|
2022-09-06 15:30:39 +00:00
|
|
|
start_wiki = WikiTargetInfo(msg).get_start_wiki()
|
|
|
|
if start_wiki is None:
|
2023-04-15 06:06:42 +00:00
|
|
|
return await msg.finish(msg.locale.t('wiki.message.not_set'))
|
2023-05-21 11:56:17 +00:00
|
|
|
res = await newbie(msg, start_wiki)
|
2022-09-06 15:30:39 +00:00
|
|
|
await msg.finish(res)
|