🐛 Fix Missing Parameters

Co-authored-by: xtaodada <xtao@xtaolink.cn>
This commit is contained in:
luoshuijs 2023-09-11 21:24:05 +08:00 committed by GitHub
parent c6799187dd
commit 4b1a2128ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 19 deletions

View File

@ -1,5 +1,4 @@
from simnet import GenshinClient, Region
from simnet.utils.player import recognize_genshin_game_biz, recognize_genshin_server
from telegram import Update, User, InlineKeyboardButton, InlineKeyboardMarkup
from telegram.constants import ChatAction
from telegram.ext import CallbackContext, CommandHandler, MessageHandler, filters, ConversationHandler
@ -87,11 +86,7 @@ class PayLogPlugin(Plugin.Conversation):
async with GenshinClient(
cookies=cookies.data, region=Region.CHINESE, lang="zh-cn", player_id=player_info.player_id
) as client:
authkey = await client.get_authkey_by_stoken(
recognize_genshin_game_biz(client.player_id),
recognize_genshin_server(client.player_id),
"csc",
)
authkey = await client.get_authkey_by_stoken("csc")
if not authkey:
await message.reply_text(
"<b>开始导入充值历史记录:请通过 https://paimon.moe/wish/import 获取抽卡记录链接后发送给我"

View File

@ -3,7 +3,6 @@ from io import BytesIO
from aiofiles import open as async_open
from simnet import GenshinClient, Region
from simnet.models.genshin.wish import BannerType
from simnet.utils.player import recognize_genshin_game_biz, recognize_genshin_server
from telegram import Document, InlineKeyboardButton, InlineKeyboardMarkup, Message, Update, User
from telegram.constants import ChatAction
from telegram.ext import CallbackContext, ConversationHandler, filters
@ -178,11 +177,7 @@ class WishLogPlugin(Plugin.Conversation):
async with GenshinClient(
cookies=cookies.data, region=Region.CHINESE, lang="zh-cn", player_id=player_info.player_id
) as client:
authkey = await client.get_authkey_by_stoken(
recognize_genshin_game_biz(client.player_id),
recognize_genshin_server(client.player_id),
"webview_gacha",
)
authkey = await client.get_authkey_by_stoken("webview_gacha")
if not authkey:
await message.reply_text(
"<b>开始导入祈愿历史记录:请通过 https://paimon.moe/wish/import 获取抽卡记录链接后发送给我"

View File

@ -20,6 +20,11 @@ from utils.log import logger
if TYPE_CHECKING:
from telegram.ext import ContextTypes
REGION = {
RegionEnum.HYPERION: Region.CHINESE,
RegionEnum.HOYOLAB: Region.OVERSEAS,
}
class RefreshCookiesJob(Plugin):
def __init__(self, cookies: CookiesService):
@ -28,11 +33,8 @@ class RefreshCookiesJob(Plugin):
@job.run_daily(time=datetime.time(hour=0, minute=1, second=0), name="RefreshCookiesJob")
async def daily_refresh_cookies(self, _: "ContextTypes.DEFAULT_TYPE"):
logger.info("正在执行每日刷新 Cookies 任务")
for db_region, client_region in {
RegionEnum.HYPERION: Region.CHINESE,
RegionEnum.HOYOLAB: Region.OVERSEAS,
}.items():
for cookie_model in await self.cookies.get_all_by_region(db_region):
for database_region, client_region in REGION.items():
for cookie_model in await self.cookies.get_all_by_region(database_region):
cookies = cookie_model.data
if cookies.get("stoken") is not None and cookie_model.status != CookiesStatusEnum.INVALID_COOKIES:
try:
@ -52,8 +54,8 @@ class RefreshCookiesJob(Plugin):
logger.warning(
"用户 user_id[%s] 刷新 Cookies 时出现错误 [%s]%s",
cookie_model.user_id,
_exc.status_code,
_exc.message,
_exc.ret_code,
_exc.original or _exc.message,
)
continue
except SimnetTimedOut: