From 2b147ad4ae816e09dfa322130b2cd2fd9025e0b5 Mon Sep 17 00:00:00 2001 From: NikolajDanger Date: Sun, 2 Aug 2020 13:52:51 +0200 Subject: [PATCH] :bullettrain_side: Slight optimization --- Gwendolyn.py | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/Gwendolyn.py b/Gwendolyn.py index 966d8f0..7ce1571 100644 --- a/Gwendolyn.py +++ b/Gwendolyn.py @@ -53,13 +53,10 @@ async def fiar(channel,command,user): with open("resources/games/oldImages/fourInARow"+str(channel), "w") as f: f.write(str(oldImage.id)) try: - await oldImage.add_reaction("1️⃣") - await oldImage.add_reaction("2️⃣") - await oldImage.add_reaction("3️⃣") - await oldImage.add_reaction("4️⃣") - await oldImage.add_reaction("5️⃣") - await oldImage.add_reaction("6️⃣") - await oldImage.add_reaction("7️⃣") + reactions = ["1️⃣","2️⃣","3️⃣","4️⃣","5️⃣","6️⃣","7️⃣"] + for reaction in reactions: + await oldImage.add_reaction(reaction) + except: logThis("Image deleted before I could react to all of them") @@ -67,13 +64,9 @@ async def fiar(channel,command,user): with open("resources/games/oldImages/fourInARow"+str(channel), "w") as f: f.write(str(oldImage.id)) try: - await oldImage.add_reaction("1️⃣") - await oldImage.add_reaction("2️⃣") - await oldImage.add_reaction("3️⃣") - await oldImage.add_reaction("4️⃣") - await oldImage.add_reaction("5️⃣") - await oldImage.add_reaction("6️⃣") - await oldImage.add_reaction("7️⃣") + reactions = ["1️⃣","2️⃣","3️⃣","4️⃣","5️⃣","6️⃣","7️⃣"] + for reaction in reactions: + await oldImage.add_reaction(reaction) except: logThis("Image deleted before I could react to all of them") # else: