Exemplo n.º 1
0
 public static BotState Initialize(string filePath)
 {
     try
     {
         var state = JsonConvert.DeserializeObject <BotState>(File.ReadAllText(filePath));
         state.FilePath = filePath;
         if (state.AdminList == null)
         {
             state.AdminList = new HashSet <ulong>();
         }
         Task.WaitAll(state.PersistState());
         return(state);
     }
     catch (Exception)
     {
         var state = new BotState
         {
             FilePath  = filePath,
             AdminList = new HashSet <ulong>()
         };
         Task.WaitAll(state.PersistState());
         return(state);
     }
 }