/// <summary> /// Ensures the WoW configuration file exists, prompting for the info if it doesn't. /// </summary> public static void EnsureWoWConfigExists() { if (!Directory.Exists(Path.Combine(AppContext.BaseDirectory, "data"))) { Directory.CreateDirectory(Path.Combine(AppContext.BaseDirectory, "data")); } string loc = Path.Combine(AppContext.BaseDirectory, "data/wowconfiguration.json"); if (!File.Exists(loc)) // Check if the configuration file exists. { var config = new WoWConfiguration(); // Create a new configuration object. Console.WriteLine("The WoW configuration file has been created at 'data\\wowconfiguration.json', " + "please enter your information and restart the bot."); Console.Write("Mashery Key: "); config.MasheryKey = Console.ReadLine(); // Read the Mashery token from console. Console.Write("Default Guild name: "); config.DefaultGuildName = Console.ReadLine(); // Read the default guild name from console. Console.Write("Default Guild realm: "); config.DefaultRealm = Console.ReadLine(); // Read the default realm from console. config.Save(); // Save the new configuration object to file. } Console.WriteLine("WoW configuration Loaded..."); }
public async Task HelpAsync() { string prefix = BotConfiguration.Load().Prefix; var builder = new EmbedBuilder() { Color = new Color(114, 137, 218), Description = "These are the commands you can use:\n(THIS IS STILL BEING WORKED ON AND IS NOT FINISHED)\n\nDefault guild is: __*" + WoWConfiguration.Load().DefaultGuildName + "*__\nDefault realm is: __*" + WoWConfiguration.Load().DefaultRealm + "*__\n\n", }; foreach (var module in _service.Modules) { string currentline = null; foreach (var cmd in module.Commands) { var result = await cmd.CheckPreconditionsAsync(Context); if (result.IsSuccess) { //currentline += $"{cmd.Aliases.First()}\n" + $"Parameters: {string.Join(", ", cmd.Parameters.Select(p => p.Name))}\t" + $"Remarks: {cmd.Remarks}\t" + $"Usage: {cmd.Summary}\n"; currentline += $"__*{cmd.Aliases.First()}*__\n" + cmd.Remarks + "\n" + $"{cmd.Summary}\n\n"; } //currentline += $"__*{cmd.Aliases.First()}*__\n" + cmd.Remarks + "\n" + $"EX: {cmd.Summary}\n\n"; //description += $"{prefix}{cmd.Aliases.First()}\n"; } if (!string.IsNullOrWhiteSpace(currentline)) { builder.AddField(x => { x.Name = "__**" + module.Name + "**__"; x.Value = currentline; //x.Value = currentline + $"Parameters: {string.Join(", ", cmd.Parameters.Select(p => p.Name))}\t" + $"Remarks: {cmd.Remarks}\t" + $"Usage: {cmd.Summary}\n"; x.IsInline = false; }); } } await ReplyAsync("", false, builder.Build()); }