mirror of
https://github.com/baiqwerdvd/StarRailUID.git
synced 2025-05-04 18:57:33 +08:00
💥支持最新版 core 配置
This commit is contained in:
parent
e8b1363e5e
commit
cbd6937cfc
@ -8,9 +8,9 @@ from gsuid_core.models import Event
|
||||
from gsuid_core.aps import scheduler
|
||||
from gsuid_core.logger import logger
|
||||
|
||||
from ..utils.database import get_sqla
|
||||
from .sign import sign_in, daily_sign
|
||||
from ....GenshinUID.GenshinUID.utils.database import get_sqla
|
||||
from ....GenshinUID.GenshinUID.utils.error_reply import UID_HINT
|
||||
from ..utils.error_reply import UID_HINT
|
||||
from ....GenshinUID.GenshinUID.genshinuid_config.gs_config import gsconfig
|
||||
|
||||
SIGN_TIME = gsconfig.get_config('SignTime').data
|
||||
|
@ -6,7 +6,7 @@ from gsuid_core.gss import gss
|
||||
from gsuid_core.logger import logger
|
||||
|
||||
from ..utils.mys_api import mys_api
|
||||
from ....GenshinUID.GenshinUID.utils.database import get_sqla
|
||||
from ..utils.database import get_sqla
|
||||
from ....GenshinUID.GenshinUID.genshinuid_config.gs_config import gsconfig
|
||||
|
||||
private_msg_list = {}
|
||||
|
26
StarRailUID/utils/database.py
Normal file
26
StarRailUID/utils/database.py
Normal file
@ -0,0 +1,26 @@
|
||||
from typing import Dict
|
||||
|
||||
from sqlalchemy import event
|
||||
from gsuid_core.data_store import get_res_path
|
||||
from gsuid_core.utils.database.dal import SQLA
|
||||
|
||||
is_wal = False
|
||||
|
||||
active_sqla: Dict[str, SQLA] = {}
|
||||
db_url = str(get_res_path().parent / 'GsData.db')
|
||||
|
||||
|
||||
def get_sqla(bot_id) -> SQLA:
|
||||
if bot_id not in active_sqla:
|
||||
sqla = SQLA(db_url, bot_id)
|
||||
active_sqla[bot_id] = sqla
|
||||
sqla.create_all()
|
||||
|
||||
@event.listens_for(sqla.engine.sync_engine, 'connect')
|
||||
def engine_connect(conn, branch):
|
||||
if is_wal:
|
||||
cursor = conn.cursor()
|
||||
cursor.execute('PRAGMA journal_mode=WAL')
|
||||
cursor.close()
|
||||
|
||||
return active_sqla[bot_id]
|
48
StarRailUID/utils/error_reply.py
Normal file
48
StarRailUID/utils/error_reply.py
Normal file
@ -0,0 +1,48 @@
|
||||
from typing import Union
|
||||
|
||||
UID_HINT = '你还没有绑定过uid哦!\n请使用[绑定uid123456]命令绑定!'
|
||||
MYS_HINT = '你还没有绑定过mysid哦!\n请使用[绑定mys1234]命令绑定!'
|
||||
CK_HINT = """你还没有绑定过Cookie哦!发送【ck帮助】获取帮助!
|
||||
警告:绑定Cookie可能会带来未知的账号风险,请确保信任机器人管理员"""
|
||||
CHAR_HINT = '你还没有{}的缓存噢!\n请先使用【强制刷新】命令来缓存数据! \n或者使用【查询展柜角色】命令查看已缓存角色!'
|
||||
VERIFY_HINT = '''出现验证码!
|
||||
如已绑定CK: 请至米游社软件->我的->我的角色处解锁验证码
|
||||
(可使用[gs关闭推送]命令关闭体力推送以减少出现验证码风险)
|
||||
如未绑定CK: 可联系管理员使用[gs清除缓存]命令
|
||||
'''
|
||||
SK_HINT = '你还没有绑定过Stoken或者Stoken已失效~\n请加好友私聊Bot\n [扫码登陆] 或 [添加]后跟SK格式 以绑定SK'
|
||||
UPDATE_HINT = '''更新失败!更多错误信息请查看控制台...
|
||||
>> 可以尝试使用
|
||||
>> [gs强制更新](危险)
|
||||
>> [gs强行强制更新](超级危险)!'''
|
||||
|
||||
|
||||
def get_error(retcode: Union[int, str]) -> str:
|
||||
if retcode == -51:
|
||||
return CK_HINT
|
||||
elif retcode == -100:
|
||||
return '您的cookie已经失效, 请重新获取!'
|
||||
elif retcode == 10001:
|
||||
return '您的cookie已经失效, 请重新获取!'
|
||||
elif retcode == 10101:
|
||||
return '当前查询CK已超过每日30次上限!'
|
||||
elif retcode == 10102:
|
||||
return '当前查询id已经设置了隐私, 无法查询!'
|
||||
elif retcode == 1034:
|
||||
return VERIFY_HINT
|
||||
elif retcode == -10001:
|
||||
return '请求体出错, 请检查具体实现代码...'
|
||||
elif retcode == 10104:
|
||||
return CK_HINT
|
||||
elif retcode == -512009:
|
||||
return '[留影叙佳期]已经获取过该内容~!'
|
||||
elif retcode == -201:
|
||||
return '你的账号可能已被封禁, 请联系米游社客服...'
|
||||
elif retcode == -501101:
|
||||
return '当前角色冒险等阶未达到10级, 暂时无法参加此活动...'
|
||||
elif retcode == 400:
|
||||
return '[MINIGG]暂未找到此内容...'
|
||||
elif retcode == -400:
|
||||
return '请输入更详细的名称...'
|
||||
else:
|
||||
return f'API报错, 错误码为{retcode}!'
|
@ -1,20 +1,18 @@
|
||||
import copy
|
||||
from typing import Dict, Union, Literal, Optional, cast
|
||||
|
||||
from ..sruid_utils.api.mys.api import _API
|
||||
from ....GenshinUID.GenshinUID.utils.database import get_sqla
|
||||
from ....GenshinUID.GenshinUID.gsuid_utils.api.mys import MysApi
|
||||
from ....GenshinUID.GenshinUID.genshinuid_config.gs_config import gsconfig
|
||||
from ....GenshinUID.GenshinUID.gsuid_utils.api.mys.models import (
|
||||
MysSign,
|
||||
SignInfo,
|
||||
)
|
||||
from ....GenshinUID.GenshinUID.gsuid_utils.api.mys.tools import (
|
||||
from gsuid_core.utils.api.mys import MysApi
|
||||
from gsuid_core.utils.api.mys.models import MysSign, SignInfo
|
||||
from gsuid_core.utils.api.mys.tools import (
|
||||
random_hex,
|
||||
generate_os_ds,
|
||||
get_web_ds_token,
|
||||
)
|
||||
|
||||
from ..utils.database import get_sqla
|
||||
from ..sruid_utils.api.mys.api import _API
|
||||
from ....GenshinUID.GenshinUID.genshinuid_config.gs_config import gsconfig
|
||||
|
||||
mysVersion = '2.44.1'
|
||||
_HEADER = {
|
||||
'x-rpc-app_version': mysVersion,
|
||||
|
16
poetry.lock
generated
16
poetry.lock
generated
@ -1,4 +1,4 @@
|
||||
# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand.
|
||||
# This file is automatically @generated by Poetry 1.4.0 and should not be changed by hand.
|
||||
|
||||
[[package]]
|
||||
name = "asgiref"
|
||||
@ -596,14 +596,14 @@ files = [
|
||||
|
||||
[[package]]
|
||||
name = "platformdirs"
|
||||
version = "3.3.0"
|
||||
version = "3.4.0"
|
||||
description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "platformdirs-3.3.0-py3-none-any.whl", hash = "sha256:ea61fd7b85554beecbbd3e9b37fb26689b227ffae38f73353cbcc1cf8bd01878"},
|
||||
{file = "platformdirs-3.3.0.tar.gz", hash = "sha256:64370d47dc3fca65b4879f89bdead8197e93e05d696d6d1816243ebae8595da5"},
|
||||
{file = "platformdirs-3.4.0-py3-none-any.whl", hash = "sha256:01437886022decaf285d8972f9526397bfae2ac55480ed372ed6d9eca048870a"},
|
||||
{file = "platformdirs-3.4.0.tar.gz", hash = "sha256:a5e1536e5ea4b1c238a1364da17ff2993d5bd28e15600c2c8224008aff6bbcad"},
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
@ -863,14 +863,14 @@ files = [
|
||||
|
||||
[[package]]
|
||||
name = "requests"
|
||||
version = "2.28.2"
|
||||
version = "2.29.0"
|
||||
description = "Python HTTP for Humans."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7, <4"
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "requests-2.28.2-py3-none-any.whl", hash = "sha256:64299f4909223da747622c030b781c0d7811e359c37124b4bd368fb8c6518baa"},
|
||||
{file = "requests-2.28.2.tar.gz", hash = "sha256:98b1b2782e3c6c4904938b84c0eb932721069dfdb9134313beff7c83c2df24bf"},
|
||||
{file = "requests-2.29.0-py3-none-any.whl", hash = "sha256:e8f3c9be120d3333921d213eef078af392fba3933ab7ed2d1cba3b56f2568c3b"},
|
||||
{file = "requests-2.29.0.tar.gz", hash = "sha256:f2e34a75f4749019bb0e3effb66683630e4ffeaf75819fb51bebef1bf5aef059"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
|
Loading…
x
Reference in New Issue
Block a user