mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
If matrix-nio is not installed, don't crash
This commit is contained in:
parent
eee9eda0f4
commit
2fa90fc4e0
2 changed files with 4 additions and 4 deletions
|
@ -58,7 +58,7 @@ def run(config_filename: str):
|
|||
|
||||
# Serfs
|
||||
telegram_process = None
|
||||
if config["Serfs"]["Telegram"]["enabled"]:
|
||||
if "Telegram" in config["Serfs"] and config["Serfs"]["Telegram"]["enabled"]:
|
||||
telegram_process = multiprocessing.Process(name="Serf.Telegram",
|
||||
target=rs.telegram.TelegramSerf.run_process,
|
||||
daemon=True,
|
||||
|
@ -76,7 +76,7 @@ def run(config_filename: str):
|
|||
log.info("Serf.Telegram: Disabled")
|
||||
|
||||
discord_process = None
|
||||
if config["Serfs"]["Discord"]["enabled"]:
|
||||
if "Discord" in config["Serfs"] and config["Serfs"]["Discord"]["enabled"]:
|
||||
discord_process = multiprocessing.Process(name="Serf.Discord",
|
||||
target=rs.discord.DiscordSerf.run_process,
|
||||
daemon=True,
|
||||
|
@ -94,7 +94,7 @@ def run(config_filename: str):
|
|||
log.info("Serf.Discord: Disabled")
|
||||
|
||||
matrix_process = None
|
||||
if config["Serfs"]["Matrix"]["enabled"]:
|
||||
if "Matrix" in config["Serfs"] and config["Serfs"]["Matrix"]["enabled"]:
|
||||
matrix_process = multiprocessing.Process(name="Serf.Matrix",
|
||||
target=rs.matrix.MatrixSerf.run_process,
|
||||
daemon=True,
|
||||
|
|
|
@ -95,7 +95,7 @@ class MatrixSerf(Serf):
|
|||
|
||||
return DiscordData
|
||||
|
||||
async def handle_message(self, room: nio.MatrixRoom, event: nio.RoomMessageText):
|
||||
async def handle_message(self, room: "nio.MatrixRoom", event: "nio.RoomMessageText"):
|
||||
# Skip events happened before the startup of the Serf
|
||||
if event.server_timestamp < self._started_timestamp:
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue