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

Fix occasional error when resolving a user by username

This commit is contained in:
Dragory 2019-04-23 05:28:50 +03:00
parent 706ccb4fce
commit 0742c19cbb

View file

@ -526,7 +526,7 @@ export async function resolveUser(bot: Client, value: string): Promise<User | Un
const usernameMatch = value.match(/^@?([^#]+)#(\d{4})$/);
if (usernameMatch) {
const user = bot.users.find(u => u.username === usernameMatch[1] && u.discriminator === usernameMatch[2]);
userId = user.id;
if (user) userId = user.id;
}
}