From 59c0f932296109b3b89aba8f6e47ff9cb11a56ef Mon Sep 17 00:00:00 2001 From: Myned Date: Tue, 21 Nov 2017 06:14:12 -0500 Subject: [PATCH] Fixed hearted assigning a reference instead of copying the embed --- src/main/cogs/booru.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/cogs/booru.py b/src/main/cogs/booru.py index 4549c18..5f4d237 100644 --- a/src/main/cogs/booru.py +++ b/src/main/cogs/booru.py @@ -7,6 +7,7 @@ from contextlib import suppress from datetime import datetime as dt from datetime import timedelta as td from fractions import gcd +import copy import discord as d from discord import errors as err @@ -729,12 +730,12 @@ class MsG: self.bot.wait_for('reaction_remove', check=on_reaction, timeout=7 * 60)]) except exc.Save: - if embed not in hearted: - hearted.append(embed) + if keys[c - 1] not in hearted: + hearted[keys[c - 1]] = copy.deepcopy(embed) await paginator.edit(content='\N{HEAVY BLACK HEART}') else: - hearted.remove(embed) + del hearted[keys[c - 1]] await paginator.edit(content='\N{BROKEN HEART}') @@ -871,8 +872,8 @@ class MsG: self.bot.wait_for('reaction_remove', check=on_reaction, timeout=7 * 60)]) except exc.Save: - if keys[c - 1] not in hearted: - hearted[keys[c - 1]] = embed + if keys[c - 1] not in hearted.keys(): + hearted[keys[c - 1]] = copy.deepcopy(embed) await paginator.edit(content='\N{HEAVY BLACK HEART}') else: @@ -1037,12 +1038,12 @@ class MsG: self.bot.wait_for('reaction_remove', check=on_reaction, timeout=7 * 60)]) except exc.Save: - if embed not in hearted: - hearted.append(embed) + if keys[c - 1] not in hearted: + hearted[keys[c - 1]] = copy.deepcopy(embed) await paginator.edit(content='\N{HEAVY BLACK HEART}') else: - hearted.remove(embed) + del hearted[keys[c - 1]] await paginator.edit(content='\N{BROKEN HEART}')