1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-12-25 14:47:29 +00:00

Fixed hearted assigning a reference instead of copying the embed

This commit is contained in:
Myned 2017-11-21 06:14:12 -05:00
parent dbaa930d57
commit 59c0f93229

View file

@ -7,6 +7,7 @@ from contextlib import suppress
from datetime import datetime as dt from datetime import datetime as dt
from datetime import timedelta as td from datetime import timedelta as td
from fractions import gcd from fractions import gcd
import copy
import discord as d import discord as d
from discord import errors as err from discord import errors as err
@ -729,12 +730,12 @@ class MsG:
self.bot.wait_for('reaction_remove', check=on_reaction, timeout=7 * 60)]) self.bot.wait_for('reaction_remove', check=on_reaction, timeout=7 * 60)])
except exc.Save: except exc.Save:
if embed not in hearted: if keys[c - 1] not in hearted:
hearted.append(embed) hearted[keys[c - 1]] = copy.deepcopy(embed)
await paginator.edit(content='\N{HEAVY BLACK HEART}') await paginator.edit(content='\N{HEAVY BLACK HEART}')
else: else:
hearted.remove(embed) del hearted[keys[c - 1]]
await paginator.edit(content='\N{BROKEN HEART}') 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)]) self.bot.wait_for('reaction_remove', check=on_reaction, timeout=7 * 60)])
except exc.Save: except exc.Save:
if keys[c - 1] not in hearted: if keys[c - 1] not in hearted.keys():
hearted[keys[c - 1]] = embed hearted[keys[c - 1]] = copy.deepcopy(embed)
await paginator.edit(content='\N{HEAVY BLACK HEART}') await paginator.edit(content='\N{HEAVY BLACK HEART}')
else: else:
@ -1037,12 +1038,12 @@ class MsG:
self.bot.wait_for('reaction_remove', check=on_reaction, timeout=7 * 60)]) self.bot.wait_for('reaction_remove', check=on_reaction, timeout=7 * 60)])
except exc.Save: except exc.Save:
if embed not in hearted: if keys[c - 1] not in hearted:
hearted.append(embed) hearted[keys[c - 1]] = copy.deepcopy(embed)
await paginator.edit(content='\N{HEAVY BLACK HEART}') await paginator.edit(content='\N{HEAVY BLACK HEART}')
else: else:
hearted.remove(embed) del hearted[keys[c - 1]]
await paginator.edit(content='\N{BROKEN HEART}') await paginator.edit(content='\N{BROKEN HEART}')