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,18 +71,18 @@ async def _(bot: Bot):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@restart.handle()
|
|
||||||
async def _():
|
|
||||||
if str(platform.system()).lower() == "windows":
|
|
||||||
await restart.finish("暂无windows重启脚本...")
|
|
||||||
|
|
||||||
|
|
||||||
@restart.got("flag", prompt="确定是否重启真寻?确定请回复[是|好|确定](重启失败咱们将失去联系,请谨慎!)")
|
@restart.got("flag", prompt="确定是否重启真寻?确定请回复[是|好|确定](重启失败咱们将失去联系,请谨慎!)")
|
||||||
async def _(flag: str = ArgStr("flag")):
|
async def _(flag: str = ArgStr("flag")):
|
||||||
if flag.lower() in ["true", "是", "好", "确定", "确定是"]:
|
if flag.lower() in ["true", "是", "好", "确定", "确定是"]:
|
||||||
await restart.send("开始重启真寻..请稍等...")
|
await restart.send("开始重启真寻..请稍等...")
|
||||||
open("is_restart", "w")
|
open("is_restart", "w")
|
||||||
os.system("./restart.sh")
|
if str(platform.system()).lower() == "windows":
|
||||||
|
import sys
|
||||||
|
python = sys.executable
|
||||||
|
os.execl(python, python, *sys.argv)
|
||||||
|
else:
|
||||||
|
os.system("./restart.sh")
|
||||||
else:
|
else:
|
||||||
await restart.send("已取消操作...")
|
await restart.send("已取消操作...")
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user