public static void UpdateAlarmuser(ulong playerId, UserAccount.AlarmUsers data) { using (var db = new LiteDatabase(@"Data\players.db")) { var user = db.GetCollection <UserAccount.AlarmUsers>("players"); var result = user.FindOne(x => x.DiscordId == playerId); if (result == null) { user.Insert(data); return; } user.Update(data); } }
public static UserAccount.AlarmUsers CreateUser(ulong id) { using (var db = new LiteDatabase(@"Data\players.db")) { var servers = db.GetCollection <UserAccount.AlarmUsers>("players"); var create = new UserAccount.AlarmUsers(); create.DiscordId = id; create.AlarmDelay = 15; create.AlarmOn = false; servers.Insert(create); var user = servers.FindOne(x => x.DiscordId == id); return(user); } }