add alias handling to server and database

This commit is contained in:
Stanley Dimant
2022-08-25 00:34:21 +02:00
parent 66e2b3db82
commit 88cec262cd
9 changed files with 553 additions and 12 deletions

View File

@@ -166,7 +166,8 @@ public class DiscordBot : IHostedService
while (!hasValidUid)
{
var uid = GenerateRandomString(10);
if (db.Users.Any(u => u.UID == uid)) continue;
if (await db.Users.AnyAsync(u => u.UID == uid).ConfigureAwait(false)) continue;
if (await db.Aliases.AnyAsync(u => u.AliasUID == uid).ConfigureAwait(false)) continue;
user.UID = uid;
hasValidUid = true;
}