public CommandHandler(DiscordSocketClient client, CommandService commands, DeltaData config) { _client = client; _commands = commands; _config = config; _services = ConfigureServices(); }
//First Time Setup static DeltaData ConfSetup() { DeltaData config = new DeltaData(); string confFile = dataFolder + "config.json"; //create DeltaCORE file structure in "AppData\Roaming\DeltaCORE\" (Windows, will create in equivelent directories on Linux and MacOS) Directory.CreateDirectory(dataFolder); Directory.CreateDirectory(dataFolder + "/Guild/"); Directory.CreateDirectory(dataFolder + "/User/"); Directory.CreateDirectory(dataFolder + "/Media/"); Directory.CreateDirectory(dataFolder + "/Plugins/"); //create config from user input Console.WriteLine("Welcome to DeltaCORE! This first run configuration will setup DeltaCORE to run on your system!"); Console.WriteLine("Please input your Bot Token:"); config.Token = Console.ReadLine(); Console.WriteLine("Please Input your prefered prefix for commands:"); config.Prefix = Console.ReadLine()[0]; JsonSerializerOptions options = new JsonSerializerOptions { WriteIndented = true // write pretty json }; //serialise and save settings for future launches string jsonstring = JsonSerializer.Serialize(config, options); File.WriteAllText(confFile, jsonstring); return(config); }
private Program() { WriteLogo(); config = Startup.ConfigStart(); PluginManager.LoadPlugins(); PluginManager.ListPlugins(); //configure SocketClient _client = new DiscordSocketClient(new DiscordSocketConfig { LogLevel = LogSeverity.Info, //MessageCacheSize = 50, }); //Create and configure Command Service _commands = new CommandService(new CommandServiceConfig { LogLevel = LogSeverity.Info, CaseSensitiveCommands = false, }); _client.Log += Log; _commands.Log += Log; }