Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions techsupport_bot/commands/factoids.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,11 @@ async def response(self, config, ctx: commands.Context, message_content: str, _)
embed = self.get_embed_from_factoid(factoid)
# if the json doesn't include non embed argument, then don't send anything
# otherwise send message text with embed
plaintext_content = factoid.message if not embed else None
try:
plaintext_content = factoid.message if not embed else None
except ValueError:
# The not embed causes a ValueError in certain cases. This ensures fallback works
plaintext_content = factoid.message
mentions = auxiliary.construct_mention_string(ctx.message.mentions)

content = " ".join(filter(None, [mentions, plaintext_content])) or None
Expand Down Expand Up @@ -840,7 +844,11 @@ async def cronjob(self, job, ctx: commands.Context = None):

# Get_embed accepts job as a factoid object
embed = self.get_embed_from_factoid(factoid)
content = factoid.message if not embed else None
try:
content = factoid.message if not embed else None
except ValueError:
# The not embed causes a ValueError in certian places. This ensures fallback works
content = factoid.message

channel = self.bot.get_channel(int(job.channel))
if not channel:
Expand Down