Okay, I am using Discord.net, creating a bot for discord(clearly), And I want to add a simple 'add default role' too the command handler, this is easily achieved, however, I want it to read from the (Configuration.json) file as we occasionally change the names, or want to add another role to the defaults, Keep in mind this is a private bot not a personal, and will only be in one server.
I am trying to use
public List<string> Roles { get; set; }
When Configuration.SaveJSON();
is used, it saves it as null, this is okay for me, but when I try and add a role using the command, I get a nullreferenceexeption.
var Roley = new Configuration();
var roles = Roley.Roleys;
roles.Add("PSN");
Roley.SaveJson();
In my head, this should work, and now add 'PSN' to the list, but it doesn't, It gives me a nullreference, which I can't wrap my head around as I am trying to set it.