Пример #1
0
        public async Task UpdateUserAsync()
        {
            TwitchUser user = (await StaticBase.Database.GetCollection <TwitchUser>("TwitchUsers").FindAsync(x => x.GuildPlusDiscordId == GuildPlusDiscordId)).FirstOrDefault();

            if (user == null)
            {
                await StaticBase.Database.GetCollection <TwitchUser>("TwitchUsers").InsertOneAsync(this);
            }
            else
            {
                await StaticBase.Database.GetCollection <TwitchUser>("TwitchUsers").ReplaceOneAsync(x => x.GuildPlusDiscordId == GuildPlusDiscordId, this);
            }
        }
Пример #2
0
 public bool ExistsUser(string twitchName, out TwitchUser user)
 {
     user = users.FirstOrDefault(x => x.TwitchName.ToLower().Equals(twitchName.ToLower()));
     return(user != null);
 }
Пример #3
0
 public void RemoveUser(TwitchUser user)
 {
     users.Remove(user);
 }
Пример #4
0
 public void AddUser(TwitchUser user)
 {
     users.Add(user);
 }