Add process controls and restart command

This commit is contained in:
Azimkin
2026-08-28 23:25:20 +02:00
parent 12434ec557
commit d3c02ca203
14 changed files with 358 additions and 4 deletions

View File

@@ -1,8 +1,10 @@
from __future__ import annotations
import html
import os
import re
import shlex
import signal
from textwrap import wrap
from typing import TYPE_CHECKING, Any
@@ -376,6 +378,17 @@ async def status(ctx: "CommandContext") -> None:
await ctx.reply("\n".join(lines))
@command_registry.command(
"restart",
"Stop the bot process so its supervisor can restart it",
usage=".restart",
category="system",
)
async def restart(ctx: "CommandContext") -> None:
await ctx.reply("Stopping bot process for restart")
os.kill(os.getpid(), signal.SIGTERM)
@command_registry.command(
"id",
"Show chat, thread, user, and replied message IDs",