Skip to content

Commit

Permalink
[Mod] Correctly log and store the previous (nick)name (#4131)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kowlin committed Sep 20, 2020
1 parent 8a75d75 commit 88503bb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions redbot/cogs/mod/events.py
Expand Up @@ -157,10 +157,10 @@ async def on_user_update(self, before: discord.User, after: discord.User):
async with self.config.user(before).past_names() as name_list:
while None in name_list: # clean out null entries from a bug
name_list.remove(None)
if after.name in name_list:
if before.name in name_list:
# Ensure order is maintained without duplicates occurring
name_list.remove(after.name)
name_list.append(after.name)
name_list.remove(before.name)
name_list.append(before.name)
while len(name_list) > 20:
name_list.pop(0)

Expand All @@ -173,8 +173,8 @@ async def on_member_update(self, before: discord.Member, after: discord.Member):
async with self.config.member(before).past_nicks() as nick_list:
while None in nick_list: # clean out null entries from a bug
nick_list.remove(None)
if after.nick in nick_list:
nick_list.remove(after.nick)
nick_list.append(after.nick)
if before.nick in nick_list:
nick_list.remove(before.nick)
nick_list.append(before.nick)
while len(nick_list) > 20:
nick_list.pop(0)

0 comments on commit 88503bb

Please sign in to comment.