Archived
1
0
Fork 0
This commit is contained in:
Dianliang233 2022-01-18 12:06:09 +08:00
parent 2637f59611
commit 5f42a883e8
No known key found for this signature in database
GPG key ID: 6C56F399D872F19C
3 changed files with 18 additions and 13 deletions

View file

@ -33,9 +33,11 @@ async def console_scheduler():
Modules = ModulesManager.return_modules_list_as_dict()
for x in Modules:
if isinstance(Modules[x], StartUp):
gather_list.append(asyncio.ensure_future(Modules[x].function(FetchTarget)))
gather_list.append(asyncio.ensure_future(
Modules[x].function(FetchTarget)))
if isinstance(Modules[x], Schedule):
Scheduler.add_job(func=Modules[x].function, trigger=Modules[x].trigger, args=[FetchTarget])
Scheduler.add_job(
func=Modules[x].function, trigger=Modules[x].trigger, args=[FetchTarget])
await asyncio.gather(*gather_list)
Scheduler.start()

View file

@ -26,6 +26,7 @@ class Template(MS):
voice = False
forward = False
delete = True
wait = True
async def sendMessage(self, msgchain, quote=True, disable_secret_check=False) -> FinishedSession:
Logger.info(msgchain)
@ -59,7 +60,8 @@ class Template(MS):
return self.session.message
async def delete(self):
print(f"(Tried to delete {self.session.message}, but I'm a console so I cannot do it :< )")
print(
f"(Tried to delete {self.session.message}, but I'm a console so I cannot do it :< )")
return True
async def checkPermission(self):

View file

@ -5,10 +5,10 @@ from modules.wiki.wikilib_v2 import QueryInfo
async def moegirl(term: str):
result = await query_pages(QueryInfo('https://zh.moegirl.org.cn/api.php', headers={'accept': '*/*',
'accept-encoding': 'gzip, deflate',
'accept-language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,en-GB;q=0.6',
'content-type': 'application/json',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62'}), term)
'accept-encoding': 'gzip, deflate',
'accept-language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,en-GB;q=0.6',
'content-type': 'application/json',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62'}), term)
msg = ''
if result['msg_list']:
for msg_item in result['msg_list']:
@ -16,15 +16,16 @@ async def moegirl(term: str):
if result['wait_msg_list']:
for msg_item in result['wait_msg_list']:
print('msg_item.text: ', msg_item.text)
redirect = re.search(r'(?<=是\[)(.*?)(?=\])', msg_item.text)[0]
redirect = re.search(
r'(?<=是:\[)(.*?)(?=\]。)', msg_item.text).group(0)
print(redirect)
if redirect:
wait = await query_pages(QueryInfo('https://zh.moegirl.org.cn/api.php', headers={'accept': '*/*',
'accept-encoding': 'gzip, deflate',
'accept-language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,en-GB;q=0.6',
'content-type': 'application/json',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62'
}), redirect)
'accept-encoding': 'gzip, deflate',
'accept-language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,en-GB;q=0.6',
'content-type': 'application/json',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62'
}), redirect)
msg += wait['msg_list'][0].text
return '[萌娘百科] ' + msg