diff options
author | 2020-03-29 14:29:36 +0200 | |
---|---|---|
committer | 2020-03-29 14:43:41 +0200 | |
commit | abc62d3e09a39decfdd400ed6f2e9c631ef2eca1 (patch) | |
tree | b3b906932568f34b3425a82aeac87c6d74a9f674 /bot/utils/decorators.py | |
parent | Deseasonify: add AssetType enum (diff) |
Deseasonify: implement generic media asset setter
Current `set_avatar`, `set_icon` and `set_banner` methods are almost
identical - they only differ in the type of asset they upload. This
leads to a lot of code repetition, especially w.r.t. error handling.
We instead add a generic method that is parametrized by an AssetType
param, and by the target entity (i.e. bot, or guild) that the asset
should be applied to. All error handling can then be done in one place.
Error handling methodology is adjusted - instead of suppressing errors,
we catch and log them. Since we no longer determine whether the upload
succeeded based on 'before' != 'after', this solves a bug where
re-applying the same asset resulted in a warning-level log, triggering
Sentry.
Diffstat (limited to 'bot/utils/decorators.py')
0 files changed, 0 insertions, 0 deletions