Archived
1
0
Fork 0

Merge branch 'Teahouse-Studios:master' into master

This commit is contained in:
ZoruaFox 2024-01-12 01:03:40 +08:00 committed by GitHub
commit aee7889f95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 5 deletions

View file

@ -32,6 +32,8 @@ def load_modules():
for file_name in dir_list:
try:
if file_name == 'secret' and not Config('enable_secret_module', False):
continue
file_path = os.path.join(load_dir_path, file_name)
fun_file = None
if os.path.isdir(file_path):

View file

@ -14,7 +14,7 @@ bot = Bot.FetchTarget
ca = module('__check_abuse__', required_superuser=True, developers=['OasisAkari'])
@ca.handle(DateTrigger(datetime.now() + timedelta(seconds=30)))
@ca.handle(DateTrigger(datetime.now() + timedelta(seconds=60)))
async def _():
if bot.name not in ['QQ', 'TEST']:
return
@ -60,7 +60,7 @@ async def _():
cn = module('__check_newbie__', required_superuser=True, developers=['OasisAkari'])
@cn.handle(DateTrigger(datetime.now() + timedelta(seconds=30)))
@cn.handle(DateTrigger(datetime.now() + timedelta(seconds=60)))
async def newbie():
if bot.name not in ['QQ', 'TEST']:
return

View file

@ -1,6 +1,7 @@
import aiohttp
from core.logger import Logger
from .dbutils import BotAccount as BotAccountDB
import base64
class LoginFailed(Exception):
@ -28,7 +29,9 @@ class BotAccount:
if req.status != 200:
raise LoginFailed(f'Login failed: {await req.text()}')
Logger.info(f'Logged in to {api_link} as {account}')
return req.cookies
output = req.cookies.output()
Logger.debug(f'Cookies: {output}')
return output
@classmethod
async def login(cls):

View file

@ -156,8 +156,6 @@ class WikiLib:
self.locale = Locale(locale)
async def get_json_from_api(self, api, _no_login=False, **kwargs) -> dict:
Logger.debug('no_login:' + str(_no_login))
Logger.debug("cookies:" + str(BotAccount.cookies))
cookies = None
if api in BotAccount.cookies and not _no_login:
cookies = BotAccount.cookies[api]