Source code for pi_portal.modules.integrations.slack.cli.commands.command_restart

"""Slack CLI Restart command."""

import os
from typing import Callable, cast

from .bases.command import SlackCommandBase


[docs]class RestartCommand(SlackCommandBase): """Slack CLI command to restart the Slack Bot process. :param bot: The configured slack bot in use. """
[docs] def invoke(self) -> None: """Restart the Slack CLI bot.""" self.slack_bot.slack_client.send_message("Rebooting myself ...") # BaseSocketModeHandler is untyped close = cast(Callable[[], None], self.slack_bot.web_socket.close) close() os._exit(1) # pylint: disable=protected-access