aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Boris Muratov <[email protected]>2021-01-26 18:06:32 +0200
committerGravatar Boris Muratov <[email protected]>2021-01-26 18:06:32 +0200
commitf23c2e78fb9ac6e6c2f7faeaeaf652c89ad8c263 (patch)
tree3f927a99c5e02b4748e1efaf03a1e83c6ac61fbc
parentAdded defcon status notifier (diff)
Make the cog update even if write to DB fails
The defcon cog should be functional even if there is some issue with writing to the DB for some reason. The functionality should have retention across restarts, but it shouldn't be its failing point. If necessary, it should be able to work with no DB at all
-rw-r--r--bot/exts/moderation/defcon.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/bot/exts/moderation/defcon.py b/bot/exts/moderation/defcon.py
index 4b25c36df..00b108feb 100644
--- a/bot/exts/moderation/defcon.py
+++ b/bot/exts/moderation/defcon.py
@@ -157,13 +157,13 @@ class Defcon(Cog):
}
)
- self.days = timedelta(days=days)
- self.update_notifier()
-
except Exception as err:
log.exception("Unable to update DEFCON settings.")
error = err
finally:
+ self.days = timedelta(days=days)
+ self.update_notifier()
+
await ctx.send(self.build_defcon_msg(action, error))
await self.send_defcon_log(action, ctx.author, error)