Compare commits
2 commits
f113c472fd
...
4cbe252852
Author | SHA1 | Date | |
---|---|---|---|
|
4cbe252852 | ||
|
0a150ad343 |
1 changed files with 8 additions and 2 deletions
10
src/auth.ts
10
src/auth.ts
|
@ -33,10 +33,16 @@ export function run(app) {
|
|||
}
|
||||
});
|
||||
|
||||
const users = await User.find({id: userInfo.id});
|
||||
const users = await User.find({id: String(userInfo.data.id)});
|
||||
let userUuid = '';
|
||||
|
||||
if (users.length === 0) {
|
||||
let newUuid = uuid.v4();
|
||||
|
||||
while (User.find({uuid: newUuid})[0]) {
|
||||
newUuid = uuid.v4();
|
||||
}
|
||||
|
||||
const newUser = new User({
|
||||
id: String(userInfo.data.id),
|
||||
createdAt: new Date(),
|
||||
|
@ -45,7 +51,7 @@ export function run(app) {
|
|||
discriminator: userInfo.data.discriminator,
|
||||
avatar: userInfo.data.avatar,
|
||||
|
||||
uuid: uuid.v4(),
|
||||
uuid: newUuid,
|
||||
});
|
||||
|
||||
userUuid = newUser.get('uuid');
|
||||
|
|
Loading…
Reference in a new issue