mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 06:12:53 +08:00
Update __init__.py
Windows 重启适配
This commit is contained in:
parent
74ade14f5e
commit
55bfa8f669
@ -71,17 +71,17 @@ async def _(bot: Bot):
|
||||
)
|
||||
|
||||
|
||||
@restart.handle()
|
||||
async def _():
|
||||
if str(platform.system()).lower() == "windows":
|
||||
await restart.finish("暂无windows重启脚本...")
|
||||
|
||||
|
||||
@restart.got("flag", prompt="确定是否重启真寻?确定请回复[是|好|确定](重启失败咱们将失去联系,请谨慎!)")
|
||||
async def _(flag: str = ArgStr("flag")):
|
||||
if flag.lower() in ["true", "是", "好", "确定", "确定是"]:
|
||||
await restart.send("开始重启真寻..请稍等...")
|
||||
open("is_restart", "w")
|
||||
if str(platform.system()).lower() == "windows":
|
||||
import sys
|
||||
python = sys.executable
|
||||
os.execl(python, python, *sys.argv)
|
||||
else:
|
||||
os.system("./restart.sh")
|
||||
else:
|
||||
await restart.send("已取消操作...")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user