From b223b816e5e86179e19683de9a2281bbe9a746f9 Mon Sep 17 00:00:00 2001
From: dnns01 <git@dnns01.de>
Date: Sat, 3 Jul 2021 22:11:12 +0200
Subject: [PATCH] Fix error with vote notifications, when not enough votes have
 been received so far.

---
 haugebot_twitch/vote_cog.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/haugebot_twitch/vote_cog.py b/haugebot_twitch/vote_cog.py
index ed9b9c7..8fee593 100644
--- a/haugebot_twitch/vote_cog.py
+++ b/haugebot_twitch/vote_cog.py
@@ -37,6 +37,9 @@ class VoteCog(commands.Cog):
             self.vote_blocked = None
 
     async def notify_vote_result(self, message, final_result=False):
+        if len(self.votes) < self.MIN_VOTES:
+            return
+
         votes_list = self.get_votes()
 
         output = f'{self.PLUS} {votes_list[0][0]} ({votes_list[0][1]}%), ' \
-- 
GitLab