Skip to content

Commit 1bb7cde

Browse files
committed
Fix empty channels
1 parent fcf3472 commit 1bb7cde

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/daf/message/text_based.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ def generate_log_context(self,
233233
mode: str - The mode used to send the message (send, edit, clear-send)
234234
}
235235
"""
236+
if not (len(succeeded_ch) + len(failed_ch)):
237+
return None
236238

237239
succeeded_ch = [{"name": str(channel), "id" : channel.id} for channel in succeeded_ch]
238240
failed_ch = [{"name": str(entry["channel"]), "id" : entry["channel"].id,

src/daf/message/voice_based.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ def generate_log_context(self,
188188
type: str - The type of the message, this is always VoiceMESSAGE.
189189
}
190190
"""
191+
if not (len(succeeded_ch) + len(failed_ch)):
192+
return None
191193

192194
succeeded_ch = [{"name": str(channel), "id" : channel.id} for channel in succeeded_ch]
193195
failed_ch = [{"name": str(entry["channel"]), "id" : entry["channel"].id,
@@ -345,6 +347,7 @@ async def _send(self) -> Union[dict, None]:
345347
errored_channels.append({"channel":channel, "reason": context["reason"]})
346348

347349
self._update_state(errored_channels)
350+
348351
return self.generate_log_context(**_data_to_send, succeeded_ch=succeeded_channels, failed_ch=errored_channels)
349352

350353
return None

0 commit comments

Comments
 (0)