From 26a8bcffa61fe7022ed23ac8b7646e1a155658c8 Mon Sep 17 00:00:00 2001 From: git-bruh Date: Fri, 23 Sep 2022 20:31:22 +0530 Subject: [PATCH] bridge: log on channel failure, update deps --- bridge/bridge.py | 11 ++++++++++- bridge/requirements.txt | 5 ++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/bridge/bridge.py b/bridge/bridge.py index c77565d..2b3c00b 100644 --- a/bridge/bridge.py +++ b/bridge/bridge.py @@ -56,7 +56,7 @@ class MatrixClient(nio.AsyncClient): def start_discord(self): # Intents to fetch members from guild. - intents = discord.Intents.default() + intents = discord.Intents.all() intents.members = True self.discord_client = DiscordClient( @@ -265,6 +265,9 @@ class DiscordClient(discord.ext.commands.Bot): async def on_ready(self): for channel in config["bridge"].keys(): channel_ = self.get_channel(int(channel)) + if not channel_: + self.matrix_client.logger.warning(f"Failed to get channel for ID {channel}") + continue self.channel_store[channel] = channel_ self.ready.set() @@ -391,6 +394,9 @@ class Callbacks(object): # Get the corresponding Discord channel. channel_id = self.get_channel(room) + if not channel_id: + return + author = room.user_name(event.sender) avatar = None @@ -499,6 +505,9 @@ class Callbacks(object): # Get the corresponding Discord channel. channel_id = self.get_channel(room) + if not channel_id: + return + # Send typing event. async with self.discord_client.channel_store[channel_id].typing(): return diff --git a/bridge/requirements.txt b/bridge/requirements.txt index 320c9dc..16946d4 100644 --- a/bridge/requirements.txt +++ b/bridge/requirements.txt @@ -1,3 +1,2 @@ -aiofiles==0.6.0 -discord.py==1.6.0 -matrix-nio==0.17.0 +discord.py==2.0.1 +matrix-nio==0.19.0