3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

Actual fix for said crash

This commit is contained in:
Dragory 2019-05-03 23:35:09 +03:00
parent a4919523c1
commit 13a38a2f64

View file

@ -12,10 +12,9 @@ export class UsernameSaver extends GlobalPlugin {
}
protected async updateUsername(user: User) {
if (!user) return;
const newUsername = `${user.username}#${user.discriminator}`;
const latestEntry = await this.usernameHistory.getLastEntry(user.id);
if (newUsername !== latestEntry.username) {
if (!latestEntry || newUsername !== latestEntry.username) {
await this.usernameHistory.addEntry(user.id, newUsername);
}
}