bridge: log on channel failure, update deps

This commit is contained in:
git-bruh 2022-09-23 20:31:22 +05:30
parent c459bddecd
commit 26a8bcffa6
No known key found for this signature in database
2 changed files with 12 additions and 4 deletions

View file

@ -56,7 +56,7 @@ class MatrixClient(nio.AsyncClient):
def start_discord(self): def start_discord(self):
# Intents to fetch members from guild. # Intents to fetch members from guild.
intents = discord.Intents.default() intents = discord.Intents.all()
intents.members = True intents.members = True
self.discord_client = DiscordClient( self.discord_client = DiscordClient(
@ -265,6 +265,9 @@ class DiscordClient(discord.ext.commands.Bot):
async def on_ready(self): async def on_ready(self):
for channel in config["bridge"].keys(): for channel in config["bridge"].keys():
channel_ = self.get_channel(int(channel)) 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.channel_store[channel] = channel_
self.ready.set() self.ready.set()
@ -391,6 +394,9 @@ class Callbacks(object):
# Get the corresponding Discord channel. # Get the corresponding Discord channel.
channel_id = self.get_channel(room) channel_id = self.get_channel(room)
if not channel_id:
return
author = room.user_name(event.sender) author = room.user_name(event.sender)
avatar = None avatar = None
@ -499,6 +505,9 @@ class Callbacks(object):
# Get the corresponding Discord channel. # Get the corresponding Discord channel.
channel_id = self.get_channel(room) channel_id = self.get_channel(room)
if not channel_id:
return
# Send typing event. # Send typing event.
async with self.discord_client.channel_store[channel_id].typing(): async with self.discord_client.channel_store[channel_id].typing():
return return

View file

@ -1,3 +1,2 @@
aiofiles==0.6.0 discord.py==2.0.1
discord.py==1.6.0 matrix-nio==0.19.0
matrix-nio==0.17.0