From f7e2617911e9a5d0f075e042b72bedc77a35616b Mon Sep 17 00:00:00 2001 From: Draper <27962761+Drapersniper@users.noreply.github.com> Date: Sun, 29 Dec 2019 14:37:50 +0000 Subject: [PATCH] Fix an attribute error that can be raised in humanize_timedelta if seconds = 0 (#3231) * Migrate Playlist to DB 3 TODO 1 Migrate Config to Schema 3 without playlists and update get_playlist methods Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com> * Revert "Migrate Playlist to DB 3 TODO 1 Migrate Config to Schema 3 without playlists and update get_playlist methods" This reverts commit 4af33cff Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com> * Allow removing tracks from queue by URL Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com> * Words matter Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com> * *sigh* Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com> * chore Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com> * Fix an attribute error that can be raised here is seconds = 0 Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com> * Fix an attribute error that can be raised here is seconds = 0 Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com> * go away Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com> * *sigh* Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com> --- changelog.d/3231.bugfix.1.rst | 1 + redbot/core/utils/chat_formatting.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog.d/3231.bugfix.1.rst diff --git a/changelog.d/3231.bugfix.1.rst b/changelog.d/3231.bugfix.1.rst new file mode 100644 index 000000000..1e996a66b --- /dev/null +++ b/changelog.d/3231.bugfix.1.rst @@ -0,0 +1 @@ +Fix an attribute error that can be raised in humanize_timedelta if seconds = 0. \ No newline at end of file diff --git a/redbot/core/utils/chat_formatting.py b/redbot/core/utils/chat_formatting.py index a5ea031a3..6c4c8d203 100644 --- a/redbot/core/utils/chat_formatting.py +++ b/redbot/core/utils/chat_formatting.py @@ -430,7 +430,7 @@ def humanize_timedelta( """ try: - obj = seconds or timedelta.total_seconds() + obj = seconds if seconds is not None else timedelta.total_seconds() except AttributeError: raise ValueError("You must provide either a timedelta or a number of seconds")