From 6c08a84bd09a2ef36e6e17d57a5c50d1947b7507 Mon Sep 17 00:00:00 2001 From: Stijn De Clercq Date: Mon, 8 Feb 2021 20:38:26 +0100 Subject: [PATCH] Check react count before adding reactions, catches an exception Fixes #32 --- functions/reactWord.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/functions/reactWord.py b/functions/reactWord.py index 854d96f..4bf39ea 100644 --- a/functions/reactWord.py +++ b/functions/reactWord.py @@ -3,6 +3,10 @@ def check(content, earlier=[]): if len(content) < 1: return False, ["Controleer je argumenten."] + # More than 20 reacts queried + if len(" ".join(content)) + len(earlier) > 20: + return False, ["Er kunnen maximaal 20 emoji's op een message geplaatst worden."] + # This command should work case insensitive for i, word in enumerate(content): content[i] = word.lower()