Add process controls and restart command
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user