From 691285a78e184e5cdf7aa64c310efeae161a8523 Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Tue, 3 May 2022 16:25:37 -0600 Subject: [PATCH] No longer assume fields are empty --- jarvis/cogs/admin/modcase.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/jarvis/cogs/admin/modcase.py b/jarvis/cogs/admin/modcase.py index f88366b..3cc446f 100644 --- a/jarvis/cogs/admin/modcase.py +++ b/jarvis/cogs/admin/modcase.py @@ -55,7 +55,7 @@ class CaseCog(Cog): action_output = "" action_output_extra = "" - for idx, action in enumerate(mod_case.actions or []): + for idx, action in enumerate(mod_case.actions): parent_action = await ACTIONS_LOOKUP[action.action_type].find_one(q(id=action.parent)) if not parent_action: action.orphaned = True @@ -78,7 +78,7 @@ class CaseCog(Cog): note_output = "" note_output_extra = "" - notes = sorted(mod_case.notes or [], key=lambda x: x.created_at) + notes = sorted(mod_case.notes, key=lambda x: x.created_at) for idx, note in enumerate(notes): admin = await self.bot.fetch_user(note.admin) admin_text = "[N/A]" @@ -322,7 +322,9 @@ class CaseCog(Cog): note = Note(admin=ctx.author.id, content=note) - case = Modlog(user=user.id, guild=ctx.guild.id, admin=ctx.author.id, notes=[note]) + case = Modlog( + user=user.id, guild=ctx.guild.id, admin=ctx.author.id, notes=[note], actions=[] + ) await case.commit() await case.reload()