mirror of
https://github.com/baiqwerdvd/StarRailUID.git
synced 2025-05-04 18:57:33 +08:00
Merge branch 'master' of https://github.com/baiqwerdvd/StarRailUID
This commit is contained in:
commit
31f9e98c0f
@ -53,7 +53,7 @@ ROGUE_LOCUST_INFO_URL = (
|
||||
f"{NEW_URL}/game_record/app/hkrpg/api/rogue_locust" # 角色寰宇蝗灾信息接口
|
||||
)
|
||||
|
||||
STAR_RAIL_GACHA_LOG_URL = f"{OLD_URL}/common/gacha_record/api/getGachaLog"
|
||||
STAR_RAIL_GACHA_LOG_URL = f"https://public-operation-hkrpg.mihoyo.com/common/gacha_record/api/getGachaLog"
|
||||
STAR_RAIL_GACHA_LOG_URL_OS = f"{OS_OLD_URL}/common/gacha_record/api/getGachaLog"
|
||||
|
||||
GET_FP_URL = "https://public-data-api.mihoyo.com/device-fp/api/getFp"
|
||||
|
@ -2,9 +2,9 @@ from typing import Dict
|
||||
|
||||
from gsuid_core.utils.plugins_config.models import (
|
||||
GSC,
|
||||
GsStrConfig,
|
||||
GsBoolConfig,
|
||||
GsListStrConfig,
|
||||
GsStrConfig,
|
||||
)
|
||||
|
||||
CONIFG_DEFAULT: Dict[str, GSC] = {
|
||||
@ -36,4 +36,9 @@ CONIFG_DEFAULT: Dict[str, GSC] = {
|
||||
"开启后mr功能将转为调用组件API, 可能缺失数据、数据不准",
|
||||
True,
|
||||
),
|
||||
"StaminaCheck": GsBoolConfig(
|
||||
"定时检查体力(全体)",
|
||||
"开启后将定时检查体力是否超过阈值",
|
||||
True,
|
||||
),
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ async def send_gacha_log_card_info(bot: Bot, ev: Event):
|
||||
@sv_get_gachalog_by_link.on_command(f"{PREFIX}导入抽卡链接")
|
||||
async def get_gachalog_by_link(bot: Bot, ev: Event):
|
||||
await bot.logger.info("开始执行[sr导入抽卡链接]")
|
||||
uid = await get_uid(bot, ev, GsBind, "sr")
|
||||
uid = await get_uid(bot, ev, GsBind, "sr", False, None)
|
||||
if uid is None:
|
||||
return await bot.send(UID_HINT)
|
||||
gacha_url = ev.text.strip()
|
||||
|
@ -32,7 +32,7 @@ async def get_new_gachalog_by_link(
|
||||
url_parse = parse.parse_qs(url.query)
|
||||
if "authkey" not in url_parse:
|
||||
return {}
|
||||
authkey = url_parse["authkey"][0]
|
||||
authkey = parse.quote(url_parse["authkey"][0], safe='')
|
||||
data = await mys_api.get_gacha_log_by_link_in_authkey(
|
||||
uid, authkey, gacha_type, page, end_id
|
||||
)
|
||||
|
@ -1,20 +1,21 @@
|
||||
import asyncio
|
||||
|
||||
from gsuid_core.aps import scheduler
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.bot import Bot
|
||||
from gsuid_core.gss import gss
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.aps import scheduler
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.segment import MessageSegment
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.utils.database.api import get_uid
|
||||
from gsuid_core.utils.database.models import GsBind
|
||||
|
||||
from .draw_stamina_card import get_stamina_img
|
||||
from .notice import get_notice_list
|
||||
from .stamina_text import get_stamina_text
|
||||
from ..utils.error_reply import UID_HINT
|
||||
from ..utils.sr_prefix import PREFIX
|
||||
from ..utils.error_reply import UID_HINT
|
||||
from .stamina_text import get_stamina_text
|
||||
from .draw_stamina_card import get_stamina_img
|
||||
from ..starrailuid_config.sr_config import srconfig
|
||||
|
||||
sv_get_stamina = SV("sr查询体力")
|
||||
sv_get_stamina_admin = SV("sr强制推送", pm=1)
|
||||
@ -41,6 +42,11 @@ async def force_notice_job(bot: Bot, ev: Event):
|
||||
|
||||
@scheduler.scheduled_job("cron", minute="*/30")
|
||||
async def sr_notice_job():
|
||||
StaminaCheck = srconfig.get_config("StaminaCheck").data
|
||||
if not StaminaCheck:
|
||||
logger.trace('[sr推送检查] 暂停...')
|
||||
return
|
||||
|
||||
result = await get_notice_list()
|
||||
logger.info("[sr推送检查]完成!等待消息推送中...")
|
||||
logger.debug(result)
|
||||
|
@ -3,14 +3,16 @@ from io import BytesIO
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
from PIL import Image, ImageDraw
|
||||
import aiohttp
|
||||
from PIL import Image, ImageDraw
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.utils.database.models import GsBind, GsUser
|
||||
from gsuid_core.utils.image.convert import convert_img
|
||||
from gsuid_core.utils.database.models import GsBind, GsUser
|
||||
|
||||
from ..utils.mys_api import mys_api
|
||||
from ..sruid_utils.api.mys.models import Expedition
|
||||
from ..starrailuid_config.sr_config import srconfig
|
||||
from ..utils.image.image_tools import get_simple_bg
|
||||
from ..utils.error_reply import get_error as get_error_msg
|
||||
from ..utils.fonts.starrail_fonts import (
|
||||
sr_font_22,
|
||||
@ -19,8 +21,6 @@ from ..utils.fonts.starrail_fonts import (
|
||||
sr_font_36,
|
||||
sr_font_50,
|
||||
)
|
||||
from ..utils.image.image_tools import get_simple_bg
|
||||
from ..utils.mys_api import mys_api
|
||||
|
||||
use_widget = srconfig.get_config("WidgetResin").data
|
||||
|
||||
|
@ -2,8 +2,8 @@ from typing import List
|
||||
|
||||
from gsuid_core.logger import logger
|
||||
|
||||
from ..utils.error_reply import get_error
|
||||
from ..utils.mys_api import mys_api
|
||||
from ..utils.error_reply import get_error
|
||||
|
||||
daily_im = """*数据刷新可能存在一定延迟,请以当前游戏实际数据为准
|
||||
==============
|
||||
@ -28,15 +28,15 @@ async def get_stamina_text(uid: str) -> str:
|
||||
rec_time = ""
|
||||
current_stamina = dailydata.current_stamina
|
||||
if current_stamina < 160:
|
||||
stamina_recover_time = seconds2hours(dailydata.stamina_recover_time)
|
||||
recover_time = seconds2hours(dailydata.stamina_recover_time)
|
||||
next_stamina_rec_time = seconds2hours(
|
||||
8 * 60
|
||||
- (
|
||||
(dailydata.max_stamina - dailydata.current_stamina) * 8 * 60
|
||||
(max_stamina - dailydata.current_stamina) * 8 * 60
|
||||
- dailydata.stamina_recover_time
|
||||
)
|
||||
)
|
||||
rec_time = f" ({next_stamina_rec_time}/{stamina_recover_time})"
|
||||
rec_time = f" ({next_stamina_rec_time}/{recover_time})"
|
||||
|
||||
accepted_epedition_num = dailydata.accepted_expedition_num
|
||||
total_expedition_num = dailydata.total_expedition_num
|
||||
@ -50,7 +50,8 @@ async def get_stamina_text(uid: str) -> str:
|
||||
finished_expedition_num += 1
|
||||
else:
|
||||
remaining_time: str = seconds2hours(expedition.remaining_time)
|
||||
expedition_info.append(f"{expedition_name} 剩余时间{remaining_time}")
|
||||
_time = f"{expedition_name} 剩余时间"
|
||||
expedition_info.append(f"{_time}{remaining_time}")
|
||||
|
||||
expedition_data = "\n".join(expedition_info)
|
||||
return daily_im.format(
|
||||
|
@ -1,34 +1,34 @@
|
||||
import copy
|
||||
import time
|
||||
from typing import Dict, Literal, Optional, Union
|
||||
from typing import Dict, Union, Literal, Optional
|
||||
|
||||
from gsuid_core.utils.api.mys.tools import (
|
||||
generate_os_ds,
|
||||
get_ds_token,
|
||||
get_web_ds_token,
|
||||
mys_version,
|
||||
)
|
||||
from gsuid_core.utils.api.mys_api import _MysApi
|
||||
import msgspec
|
||||
from gsuid_core.utils.api.mys_api import _MysApi
|
||||
from gsuid_core.utils.api.mys.tools import (
|
||||
mys_version,
|
||||
get_ds_token,
|
||||
generate_os_ds,
|
||||
get_web_ds_token,
|
||||
)
|
||||
|
||||
from ..sruid_utils.api.mys.api import _API
|
||||
from ..sruid_utils.api.mys.models import (
|
||||
AbyssBossData,
|
||||
AbyssData,
|
||||
AbyssStoryData,
|
||||
AvatarDetail,
|
||||
AvatarInfo,
|
||||
DailyNoteData,
|
||||
GachaLog,
|
||||
MonthlyAward,
|
||||
MysSign,
|
||||
RogueData,
|
||||
RogueLocustData,
|
||||
RoleBasicInfo,
|
||||
RoleIndex,
|
||||
GachaLog,
|
||||
SignInfo,
|
||||
SignList,
|
||||
AbyssData,
|
||||
RogueData,
|
||||
RoleIndex,
|
||||
AvatarInfo,
|
||||
AvatarDetail,
|
||||
MonthlyAward,
|
||||
AbyssBossData,
|
||||
DailyNoteData,
|
||||
RoleBasicInfo,
|
||||
WidgetStamina,
|
||||
AbyssStoryData,
|
||||
RogueLocustData,
|
||||
)
|
||||
|
||||
RECOGNIZE_SERVER = {
|
||||
@ -111,11 +111,9 @@ class MysApi(_MysApi):
|
||||
header["x-rpc-channel"] = "beta"
|
||||
device_id = await self.get_user_device_id(uid, "sr")
|
||||
header["x-rpc-device_id"] = "23" if device_id is None else device_id
|
||||
header["x-rpc-app_version"] = "2.53.0"
|
||||
header["x-rpc-device_model"] = "Mi 10"
|
||||
fp = await self.get_user_fp(uid, "sr")
|
||||
header["x-rpc-device_fp"] = "Asmr489" if fp is None else fp
|
||||
header["x-rpc-client_type"] = "2"
|
||||
header["DS"] = get_ds_token()
|
||||
header["Referer"] = "https://app.mihoyo.com"
|
||||
del header["Origin"]
|
||||
@ -216,13 +214,14 @@ class MysApi(_MysApi):
|
||||
HEADER["Cookie"] = ck
|
||||
HEADER["DS"] = generate_os_ds()
|
||||
header = HEADER
|
||||
os_server = "prod_official_asia"
|
||||
data = await self.simple_sr_req(
|
||||
"STAR_RAIL_AVATAR_INFO_URL",
|
||||
uid,
|
||||
params={
|
||||
"need_wiki": "true" if need_wiki else "false",
|
||||
"role_id": uid,
|
||||
"server": RECOGNIZE_SERVER.get(str(uid)[0], "prod_official_asia"),
|
||||
"server": RECOGNIZE_SERVER.get(str(uid)[0], os_server),
|
||||
},
|
||||
header=header,
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user