mirror of
https://github.com/KimigaiiWuyi/GenshinUID.git
synced 2025-05-08 04:55:51 +08:00
✨ 可配置gs重启
运行的控制台命令
This commit is contained in:
parent
7808c2b06e
commit
89b016b729
@ -23,14 +23,14 @@ red_color = (255, 66, 66)
|
|||||||
green_color = (74, 189, 119)
|
green_color = (74, 189, 119)
|
||||||
|
|
||||||
max_data = {
|
max_data = {
|
||||||
'成就': 892,
|
'成就': 939,
|
||||||
'华丽的宝箱': 185,
|
'华丽的宝箱': 185,
|
||||||
'珍贵的宝箱': 487,
|
'珍贵的宝箱': 503,
|
||||||
'精致的宝箱': 1589,
|
'精致的宝箱': 1629,
|
||||||
'普通的宝箱': 2527,
|
'普通的宝箱': 2632,
|
||||||
'奇馈宝箱': 146,
|
'奇馈宝箱': 146,
|
||||||
'解锁传送点': 286,
|
'解锁传送点': 303,
|
||||||
'解锁秘境': 48,
|
'解锁秘境': 51,
|
||||||
}
|
}
|
||||||
|
|
||||||
award_data = {
|
award_data = {
|
||||||
|
@ -17,6 +17,11 @@ CONIFG_DEFAULT: Dict[str, GSC] = {
|
|||||||
'用于面板查询的随机图API',
|
'用于面板查询的随机图API',
|
||||||
'https://genshin-res.cherishmoon.fun/img?name=',
|
'https://genshin-res.cherishmoon.fun/img?name=',
|
||||||
),
|
),
|
||||||
|
'restart_command': GsStrConfig(
|
||||||
|
'重启命令',
|
||||||
|
'自定义使用gs重启时触发的控制台命令(看不懂勿改)',
|
||||||
|
'poetry run python',
|
||||||
|
),
|
||||||
'Ann_Groups': GsDictConfig(
|
'Ann_Groups': GsDictConfig(
|
||||||
'推送公告群组',
|
'推送公告群组',
|
||||||
'原神公告推送群组',
|
'原神公告推送群组',
|
||||||
|
@ -13,7 +13,7 @@ from .models import (
|
|||||||
GsListStrConfig,
|
GsListStrConfig,
|
||||||
)
|
)
|
||||||
|
|
||||||
STR_CONFIG = Literal['proxy', '_pass_API', 'random_pic_API']
|
STR_CONFIG = Literal['proxy', '_pass_API', 'random_pic_API', 'restart_command']
|
||||||
LIST_INT_CONFIG = Literal['Ann_Ids']
|
LIST_INT_CONFIG = Literal['Ann_Ids']
|
||||||
LIST_STR_CONFIG = Literal['SignTime', 'BBSTaskTime']
|
LIST_STR_CONFIG = Literal['SignTime', 'BBSTaskTime']
|
||||||
DICT_CONFIG = Literal['Ann_Groups']
|
DICT_CONFIG = Literal['Ann_Groups']
|
||||||
|
@ -21,7 +21,10 @@ async def import_gachalogs(history_url: str, type: str, uid: str) -> str:
|
|||||||
history_data: dict = json.loads(get(history_url).text)
|
history_data: dict = json.loads(get(history_url).text)
|
||||||
else:
|
else:
|
||||||
data_bytes = base64.b64decode(history_url)
|
data_bytes = base64.b64decode(history_url)
|
||||||
history_data = json.loads(data_bytes.decode('gbk'))
|
try:
|
||||||
|
history_data = json.loads(data_bytes.decode())
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
history_data = json.loads(data_bytes.decode('gbk'))
|
||||||
if 'info' in history_data and 'uid' in history_data['info']:
|
if 'info' in history_data and 'uid' in history_data['info']:
|
||||||
data_uid = history_data['info']['uid']
|
data_uid = history_data['info']['uid']
|
||||||
if data_uid != uid:
|
if data_uid != uid:
|
||||||
|
@ -5,6 +5,8 @@ import platform
|
|||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
from ..genshinuid_config.gs_config import gsconfig
|
||||||
|
|
||||||
bot_start = Path(__file__).parents[4] / 'core.py'
|
bot_start = Path(__file__).parents[4] / 'core.py'
|
||||||
restart_sh_path = Path().cwd() / 'gs_restart.sh'
|
restart_sh_path = Path().cwd() / 'gs_restart.sh'
|
||||||
update_log_path = Path(__file__).parent / 'update_log.json'
|
update_log_path = Path(__file__).parent / 'update_log.json'
|
||||||
@ -13,9 +15,11 @@ _restart_sh = '''#!/bin/bash
|
|||||||
kill -9 {}
|
kill -9 {}
|
||||||
{} &'''
|
{} &'''
|
||||||
|
|
||||||
|
restart_command = gsconfig.get_config('restart_command').data
|
||||||
|
|
||||||
|
|
||||||
async def get_restart_sh() -> str:
|
async def get_restart_sh() -> str:
|
||||||
args = f'poetry run python {str(bot_start.absolute())}'
|
args = f'{restart_command} {str(bot_start.absolute())}'
|
||||||
return _restart_sh.format(str(bot_start.absolute()), args)
|
return _restart_sh.format(str(bot_start.absolute()), args)
|
||||||
|
|
||||||
|
|
||||||
@ -42,12 +46,12 @@ async def restart_genshinuid(
|
|||||||
json.dump(update_log, f)
|
json.dump(update_log, f)
|
||||||
if platform.system() == 'Linux':
|
if platform.system() == 'Linux':
|
||||||
subprocess.Popen(
|
subprocess.Popen(
|
||||||
f'kill -9 {pid} & poetry run python {bot_start}',
|
f'kill -9 {pid} & {restart_command} {bot_start}',
|
||||||
shell=True,
|
shell=True,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
subprocess.Popen(
|
subprocess.Popen(
|
||||||
f'taskkill /F /PID {pid} & poetry run python {bot_start}',
|
f'taskkill /F /PID {pid} & {restart_command} {bot_start}',
|
||||||
shell=True,
|
shell=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -619,7 +619,8 @@
|
|||||||
"茄子",
|
"茄子",
|
||||||
"紫茄子",
|
"紫茄子",
|
||||||
"阿忍",
|
"阿忍",
|
||||||
"忍姐"
|
"忍姐",
|
||||||
|
"九岐忍"
|
||||||
],
|
],
|
||||||
"神里绫人": [
|
"神里绫人": [
|
||||||
"Kamisato Ayato",
|
"Kamisato Ayato",
|
||||||
@ -669,7 +670,8 @@
|
|||||||
"Nilou",
|
"Nilou",
|
||||||
"nilou",
|
"nilou",
|
||||||
"尼露",
|
"尼露",
|
||||||
"尼禄"
|
"尼禄",
|
||||||
|
"红牛"
|
||||||
],
|
],
|
||||||
"赛诺": [
|
"赛诺": [
|
||||||
"Cyno",
|
"Cyno",
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
GenshinUID_version = '3.1.0'
|
GenshinUID_version = '4.0.2'
|
||||||
Genshin_version = '3.6.0'
|
Genshin_version = '3.6.0'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user