fix(restart): send completion notice after channel is ready and unify runtime keys
This commit is contained in:
@@ -9,6 +9,7 @@ import sys
|
||||
from nanobot import __version__
|
||||
from nanobot.bus.events import OutboundMessage
|
||||
from nanobot.command.router import CommandContext, CommandRouter
|
||||
from nanobot.config.runtime_keys import RESTART_NOTIFY_CHANNEL_ENV, RESTART_NOTIFY_CHAT_ID_ENV
|
||||
from nanobot.utils.helpers import build_status_content
|
||||
|
||||
|
||||
@@ -35,6 +36,8 @@ async def cmd_stop(ctx: CommandContext) -> OutboundMessage:
|
||||
async def cmd_restart(ctx: CommandContext) -> OutboundMessage:
|
||||
"""Restart the process in-place via os.execv."""
|
||||
msg = ctx.msg
|
||||
os.environ[RESTART_NOTIFY_CHANNEL_ENV] = msg.channel
|
||||
os.environ[RESTART_NOTIFY_CHAT_ID_ENV] = msg.chat_id
|
||||
|
||||
async def _do_restart():
|
||||
await asyncio.sleep(1)
|
||||
|
||||
Reference in New Issue
Block a user