mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-25 18:04:10 +00:00
🐛 Fix Missing Parameters
Co-authored-by: xtaodada <xtao@xtaolink.cn>
This commit is contained in:
parent
c6799187dd
commit
4b1a2128ab
@ -1,5 +1,4 @@
|
|||||||
from simnet import GenshinClient, Region
|
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 import Update, User, InlineKeyboardButton, InlineKeyboardMarkup
|
||||||
from telegram.constants import ChatAction
|
from telegram.constants import ChatAction
|
||||||
from telegram.ext import CallbackContext, CommandHandler, MessageHandler, filters, ConversationHandler
|
from telegram.ext import CallbackContext, CommandHandler, MessageHandler, filters, ConversationHandler
|
||||||
@ -87,11 +86,7 @@ class PayLogPlugin(Plugin.Conversation):
|
|||||||
async with GenshinClient(
|
async with GenshinClient(
|
||||||
cookies=cookies.data, region=Region.CHINESE, lang="zh-cn", player_id=player_info.player_id
|
cookies=cookies.data, region=Region.CHINESE, lang="zh-cn", player_id=player_info.player_id
|
||||||
) as client:
|
) as client:
|
||||||
authkey = await client.get_authkey_by_stoken(
|
authkey = await client.get_authkey_by_stoken("csc")
|
||||||
recognize_genshin_game_biz(client.player_id),
|
|
||||||
recognize_genshin_server(client.player_id),
|
|
||||||
"csc",
|
|
||||||
)
|
|
||||||
if not authkey:
|
if not authkey:
|
||||||
await message.reply_text(
|
await message.reply_text(
|
||||||
"<b>开始导入充值历史记录:请通过 https://paimon.moe/wish/import 获取抽卡记录链接后发送给我"
|
"<b>开始导入充值历史记录:请通过 https://paimon.moe/wish/import 获取抽卡记录链接后发送给我"
|
||||||
|
@ -3,7 +3,6 @@ from io import BytesIO
|
|||||||
from aiofiles import open as async_open
|
from aiofiles import open as async_open
|
||||||
from simnet import GenshinClient, Region
|
from simnet import GenshinClient, Region
|
||||||
from simnet.models.genshin.wish import BannerType
|
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 import Document, InlineKeyboardButton, InlineKeyboardMarkup, Message, Update, User
|
||||||
from telegram.constants import ChatAction
|
from telegram.constants import ChatAction
|
||||||
from telegram.ext import CallbackContext, ConversationHandler, filters
|
from telegram.ext import CallbackContext, ConversationHandler, filters
|
||||||
@ -178,11 +177,7 @@ class WishLogPlugin(Plugin.Conversation):
|
|||||||
async with GenshinClient(
|
async with GenshinClient(
|
||||||
cookies=cookies.data, region=Region.CHINESE, lang="zh-cn", player_id=player_info.player_id
|
cookies=cookies.data, region=Region.CHINESE, lang="zh-cn", player_id=player_info.player_id
|
||||||
) as client:
|
) as client:
|
||||||
authkey = await client.get_authkey_by_stoken(
|
authkey = await client.get_authkey_by_stoken("webview_gacha")
|
||||||
recognize_genshin_game_biz(client.player_id),
|
|
||||||
recognize_genshin_server(client.player_id),
|
|
||||||
"webview_gacha",
|
|
||||||
)
|
|
||||||
if not authkey:
|
if not authkey:
|
||||||
await message.reply_text(
|
await message.reply_text(
|
||||||
"<b>开始导入祈愿历史记录:请通过 https://paimon.moe/wish/import 获取抽卡记录链接后发送给我"
|
"<b>开始导入祈愿历史记录:请通过 https://paimon.moe/wish/import 获取抽卡记录链接后发送给我"
|
||||||
|
@ -20,6 +20,11 @@ from utils.log import logger
|
|||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram.ext import ContextTypes
|
from telegram.ext import ContextTypes
|
||||||
|
|
||||||
|
REGION = {
|
||||||
|
RegionEnum.HYPERION: Region.CHINESE,
|
||||||
|
RegionEnum.HOYOLAB: Region.OVERSEAS,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class RefreshCookiesJob(Plugin):
|
class RefreshCookiesJob(Plugin):
|
||||||
def __init__(self, cookies: CookiesService):
|
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")
|
@job.run_daily(time=datetime.time(hour=0, minute=1, second=0), name="RefreshCookiesJob")
|
||||||
async def daily_refresh_cookies(self, _: "ContextTypes.DEFAULT_TYPE"):
|
async def daily_refresh_cookies(self, _: "ContextTypes.DEFAULT_TYPE"):
|
||||||
logger.info("正在执行每日刷新 Cookies 任务")
|
logger.info("正在执行每日刷新 Cookies 任务")
|
||||||
for db_region, client_region in {
|
for database_region, client_region in REGION.items():
|
||||||
RegionEnum.HYPERION: Region.CHINESE,
|
for cookie_model in await self.cookies.get_all_by_region(database_region):
|
||||||
RegionEnum.HOYOLAB: Region.OVERSEAS,
|
|
||||||
}.items():
|
|
||||||
for cookie_model in await self.cookies.get_all_by_region(db_region):
|
|
||||||
cookies = cookie_model.data
|
cookies = cookie_model.data
|
||||||
if cookies.get("stoken") is not None and cookie_model.status != CookiesStatusEnum.INVALID_COOKIES:
|
if cookies.get("stoken") is not None and cookie_model.status != CookiesStatusEnum.INVALID_COOKIES:
|
||||||
try:
|
try:
|
||||||
@ -52,8 +54,8 @@ class RefreshCookiesJob(Plugin):
|
|||||||
logger.warning(
|
logger.warning(
|
||||||
"用户 user_id[%s] 刷新 Cookies 时出现错误 [%s]%s",
|
"用户 user_id[%s] 刷新 Cookies 时出现错误 [%s]%s",
|
||||||
cookie_model.user_id,
|
cookie_model.user_id,
|
||||||
_exc.status_code,
|
_exc.ret_code,
|
||||||
_exc.message,
|
_exc.original or _exc.message,
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
except SimnetTimedOut:
|
except SimnetTimedOut:
|
||||||
|
Loading…
Reference in New Issue
Block a user