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
|
# Serfs
|
||||||
telegram_process = None
|
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",
|
telegram_process = multiprocessing.Process(name="Serf.Telegram",
|
||||||
target=rs.telegram.TelegramSerf.run_process,
|
target=rs.telegram.TelegramSerf.run_process,
|
||||||
daemon=True,
|
daemon=True,
|
||||||
|
@ -76,7 +76,7 @@ def run(config_filename: str):
|
||||||
log.info("Serf.Telegram: Disabled")
|
log.info("Serf.Telegram: Disabled")
|
||||||
|
|
||||||
discord_process = None
|
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",
|
discord_process = multiprocessing.Process(name="Serf.Discord",
|
||||||
target=rs.discord.DiscordSerf.run_process,
|
target=rs.discord.DiscordSerf.run_process,
|
||||||
daemon=True,
|
daemon=True,
|
||||||
|
@ -94,7 +94,7 @@ def run(config_filename: str):
|
||||||
log.info("Serf.Discord: Disabled")
|
log.info("Serf.Discord: Disabled")
|
||||||
|
|
||||||
matrix_process = None
|
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",
|
matrix_process = multiprocessing.Process(name="Serf.Matrix",
|
||||||
target=rs.matrix.MatrixSerf.run_process,
|
target=rs.matrix.MatrixSerf.run_process,
|
||||||
daemon=True,
|
daemon=True,
|
||||||
|
|
|
@ -95,7 +95,7 @@ class MatrixSerf(Serf):
|
||||||
|
|
||||||
return DiscordData
|
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
|
# Skip events happened before the startup of the Serf
|
||||||
if event.server_timestamp < self._started_timestamp:
|
if event.server_timestamp < self._started_timestamp:
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue