Skip to content

Commit c1c1f84

Browse files
committed
Fixed
1 parent 13a4f28 commit c1c1f84

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/daf/guild.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,11 @@ async def initialize(self, getter: Callable) -> None:
192192

193193
if self.apiobject is not None:
194194
for message in self._messages_uninitialized:
195-
await self.add_message(message)
195+
try:
196+
await self.add_message(message)
197+
except (TypeError, ValueError, DAFError) as exc:
198+
trace(f"[GUILD:] Unable to initialize message {message}, in {self}\nReason: {exc}", TraceLEVELS.WARNING)
199+
196200

197201
self._messages_uninitialized.clear()
198202
return

src/daf/message/text_based.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ async def initialize(self, parent: Any):
269269
ch_i += 1
270270

271271
if not len(self.channels):
272-
raise ValueError(f"No valid channels were passed to {type(self)} object")
272+
raise ValueError(f"No valid channels were passed to {self} object")
273273

274274
async def _handle_error(self, channel: Union[discord.TextChannel, discord.Thread], ex: Exception) -> bool:
275275
"""
@@ -330,7 +330,7 @@ async def _send_channel(self,
330330

331331
# Check if channel still exists in cache (has not been deleted)
332332
if client.get_client().get_channel(channel.id) is None:
333-
ex = self._generate_exception(404, 10003, "Channel was deleted", discord.NotFound)
333+
raise self._generate_exception(404, 10003, "Channel was deleted", discord.NotFound)
334334

335335
# Delete previous message if clear-send mode is chosen and message exists
336336
if self.mode == "clear-send" and self.sent_messages.get(channel.id, None) is not None:

src/daf/message/voice_based.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ async def initialize(self, parent: Any):
247247
ch_i += 1
248248

249249
if not len(self.channels):
250-
raise ValueError(f"No valid channels were passed to {type(self)} object")
250+
raise ValueError(f"No valid channels were passed to {self} object")
251251

252252
async def _send_channel(self,
253253
channel: discord.VoiceChannel,
@@ -275,7 +275,7 @@ async def _send_channel(self,
275275

276276
# Check if channel still exists in cache (has not been deleted)
277277
if client.get_client().get_channel(channel.id) is None:
278-
ex = self._generate_exception(404, 10003, "Channel was deleted", discord.NotFound)
278+
raise self._generate_exception(404, 10003, "Channel was deleted", discord.NotFound)
279279

280280
if GLOBALS.voice_client is None or not GLOBALS.voice_client.is_connected():
281281
GLOBALS.voice_client = await channel.connect(timeout=C_VC_CONNECT_TIMEOUT)

0 commit comments

Comments
 (0)