From 38bbfed7174bccf5490e5f931b3d8ba8e15922b9 Mon Sep 17 00:00:00 2001 From: ambdroid <61042504+ambdroid@users.noreply.github.com> Date: Wed, 28 Aug 2024 15:31:38 -0400 Subject: [PATCH] Fix Poll.duration rounding error --- discord/poll.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/discord/poll.py b/discord/poll.py index 7dc3897ac..88ed5b534 100644 --- a/discord/poll.py +++ b/discord/poll.py @@ -384,9 +384,9 @@ class Poll: question_data = data.get('question') question = question_data.get('text') expiry = utils.parse_time(data['expiry']) # If obtained via API, then expiry is set. - duration = expiry - message.created_at + # expiry - message.created_at may be a few nanos away from the actual duration + duration = datetime.timedelta(hours=round((expiry - message.created_at).total_seconds() / 3600)) # self.created_at = message.created_at - # duration = self.created_at - expiry self = cls( duration=duration,