public async Task <User> LoginDiscordUser(MyIUser discordUser) { var user = await FindDiscordUser(discordUser.Id); if (user != null) { user.Username = discordUser.Username; user.Discriminator = discordUser.Discriminator; user.ProfileUrl = discordUser.GetAvatarUrl(); user.RefreshToken = Guid.NewGuid(); user.RefreshTokenExpires = DateTime.UtcNow.Add(RefreshTokenValidFor); } else { await _db.Users.AddAsync(new User { DiscordId = discordUser.Id.ToString(), Username = discordUser.Username, Discriminator = discordUser.Discriminator, ProfileUrl = discordUser.GetAvatarUrl(), RefreshToken = Guid.NewGuid(), RefreshTokenExpires = DateTime.UtcNow.Add(RefreshTokenValidFor), }); } await _db.SaveChangesAsync(); return(await FindDiscordUser(discordUser.Id)); }
public async Task UpdateUser(Guid userId, MyIUser discordUser) { var user = await FindUser(userId); user.Username = discordUser.Username; user.Discriminator = discordUser.Discriminator; user.ProfileUrl = discordUser.GetAvatarUrl(); await _db.SaveChangesAsync(); }
public async Task UpdateUser(Guid platformUserId, MyIUser discordUser) { await _natsService.RequestAsync(new UpdateUserRequest { PlatformUserId = platformUserId, DiscordUser = discordUser }); }
public async Task <User> LoginDiscordUser(MyIUser discordUser) { var msg = await _natsService.RequestAsync(new LoginDiscordUserRequest { User = discordUser }); return(msg.GetData <User>()); }