mirror of
https://onedev.fprog.nl/DiscordClient
synced 2025-12-29 06:28:37 +01:00
Using IConfiguration for obtaining token.
This commit is contained in:
parent
d630280dc1
commit
805f85eb2f
|
|
@ -9,12 +9,11 @@ IConfiguration configuration = new ConfigurationBuilder()
|
|||
.AddXmlFile("config.xml", true)
|
||||
.Build();
|
||||
|
||||
string? token = Environment.GetEnvironmentVariable("DISCORD_TOKEN");
|
||||
string? token = configuration.GetSection("Token").Value;
|
||||
|
||||
if (token == null)
|
||||
if(token is null)
|
||||
{
|
||||
// Exit.
|
||||
Console.WriteLine("Token is null. Make sure you set the DISCORD_TOKEN environmental variable.");
|
||||
Console.WriteLine("Token has not been found in any form of configuration.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue