[Mod] Correctly log and store the previous (nick)name (#4131)

This commit is contained in:
Kowlin 2020-09-20 02:42:12 +02:00 committed by GitHub
parent 8a75d75d83
commit 88503bbf24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -157,10 +157,10 @@ class Events(MixinMeta):
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)
@ -173,8 +173,8 @@ class Events(MixinMeta):
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)