private async Task<User> CreateUser(string userID) { User user = new User() { Id = userID, Channels = new ConcurrentDictionary<string, UserChannel>(), Data = new ConcurrentDictionary<string, object>() }; try { await _api.SetUserInfo(user); await _repoStore.Repository<User>().Create(user); } catch (Exception e) { _logger.Error(e); } return user; }
public async Task SetUserInfo(User user) { user.Name = user.Id.ToUpper(); }
private async Task CreateChannelForUser(Message parsedMessage, User user) { if (!user.Channels.ContainsKey(parsedMessage.Channel)) { user.Channels.Add(parsedMessage.Channel, new UserChannel() { Name = parsedMessage.Channel }); await _repoStore.Repository<User>().Update(user.Id, user); } }
private async Task MakeUserMod(Message message, User user) { user.Channels[message.Channel].IsModerator = true; await _repoStore.Repository<User>().Update(user.Id, user); }