Added option to login with a token.
This commit is contained in:
		| @@ -5,9 +5,10 @@ namespace NadekoBot.Classes.JSONModels | ||||
|     { | ||||
|         public string Username = "myemail@email.com"; | ||||
|         public string Password = "xxxxxxx"; | ||||
|         public string Token = ""; | ||||
|         public ulong BotId = 1231231231231; | ||||
|         public string GoogleAPIKey = ""; | ||||
|         public ulong[] OwnerIds = {123123123123, 5675675679845}; | ||||
|         public ulong[] OwnerIds = { 123123123123, 5675675679845 }; | ||||
|         public string TrelloAppKey = ""; | ||||
|         public string SoundCloudClientID = ""; | ||||
|         public string MashapeKey = ""; | ||||
|   | ||||
| @@ -68,9 +68,10 @@ namespace NadekoBot | ||||
|                 Config.Quotes = JsonConvert.DeserializeObject<List<Quote>>(File.ReadAllText("data/quotes.json")); | ||||
|                 Config.PokemonTypes = JsonConvert.DeserializeObject<List<PokemonType>>(File.ReadAllText("data/PokemonTypes.json")); | ||||
|             } | ||||
|             catch | ||||
|             catch (Exception ex) | ||||
|             { | ||||
|                 Console.WriteLine("Failed loading configuration."); | ||||
|                 Console.WriteLine(ex); | ||||
|                 Console.ReadKey(); | ||||
|                 return; | ||||
|             } | ||||
| @@ -88,7 +89,7 @@ namespace NadekoBot | ||||
|             } | ||||
|  | ||||
|             //if password is not entered, prompt for password | ||||
|             if (string.IsNullOrWhiteSpace(Creds.Password)) | ||||
|             if (string.IsNullOrWhiteSpace(Creds.Password) && !string.IsNullOrWhiteSpace(Creds.Token)) | ||||
|             { | ||||
|                 Console.WriteLine("Password blank. Please enter your password:\n"); | ||||
|                 Creds.Password = Console.ReadLine(); | ||||
| @@ -166,7 +167,7 @@ namespace NadekoBot | ||||
|             modules.Add(new Conversations(), "Conversations", ModuleFilter.None); | ||||
|             modules.Add(new GamblingModule(), "Gambling", ModuleFilter.None); | ||||
|             modules.Add(new GamesModule(), "Games", ModuleFilter.None); | ||||
|             modules.Add(new Music(), "Music", ModuleFilter.None); | ||||
|             //modules.Add(new Music(), "Music", ModuleFilter.None); | ||||
|             modules.Add(new Searches(), "Searches", ModuleFilter.None); | ||||
|             modules.Add(new NSFW(), "NSFW", ModuleFilter.None); | ||||
|             modules.Add(new ClashOfClans(), "ClashOfClans", ModuleFilter.None); | ||||
| @@ -180,12 +181,17 @@ namespace NadekoBot | ||||
|             { | ||||
|                 try | ||||
|                 { | ||||
|                     await Client.Connect(Creds.Username, Creds.Password); | ||||
|                     if (string.IsNullOrWhiteSpace(Creds.Token)) | ||||
|                         await Client.Connect(Creds.Username, Creds.Password); | ||||
|                     else | ||||
|                         await Client.Connect(Creds.Token); | ||||
|                 } | ||||
|                 catch (Exception ex) | ||||
|                 { | ||||
|                     Console.WriteLine($"Probably wrong EMAIL or PASSWORD.\n{ex.Message}"); | ||||
|                     Console.ReadKey(); | ||||
|                     if (string.IsNullOrWhiteSpace(Creds.Token)) | ||||
|                         Console.WriteLine($"Probably wrong EMAIL or PASSWORD."); | ||||
|                     else | ||||
|                         Console.WriteLine($"Token is wrong. Don't set a token if you don't have an official BOT account."); | ||||
|                     Console.WriteLine(ex); | ||||
|                     Console.ReadKey(); | ||||
|                     return; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user