internal CommandBuilder(CommandService service, Command command, string prefix = "", string category = "", IEnumerable<IPermissionChecker> initialChecks = null) { _service = service; _command = command; _command.Category = category; _params = new List<CommandParameter>(); if (initialChecks != null) _checks = new List<IPermissionChecker>(initialChecks); else _checks = new List<IPermissionChecker>(); _prefix = prefix; _aliases = new List<string>(); _allowRequiredParams = true; _areParamsClosed = false; }
internal CommandBuilder(CommandService service, string text, string prefix = "", string category = "", IEnumerable<IPermissionChecker> initialChecks = null, bool defaultNsfwFlag = false, bool defaultMusicFlag = false) { _service = service; _prefix = prefix; _command = new Command(AppendPrefix(prefix, text)) { NsfwFlag = defaultNsfwFlag, MusicFlag = defaultMusicFlag }; _command.Category = category; if (initialChecks != null) _checks = new List<IPermissionChecker>(initialChecks); else _checks = new List<IPermissionChecker>(); _params = new List<CommandParameter>(); _aliases = new List<string>(); _allowRequiredParams = true; _areParamsClosed = false; }
internal CommandGroupBuilder(CommandService service, string prefix, IEnumerable<IPermissionChecker> initialChecks = null, bool defaultNsfwFlag = false, bool defaultMusicFlag = false) { _service = service; _prefix = prefix; if (initialChecks != null) _checks = new List<IPermissionChecker>(initialChecks); else _checks = new List<IPermissionChecker>(); _defaultNsfwFlag = defaultNsfwFlag; _defaultMusicFlag = defaultMusicFlag; }
private static void LoadConfig() { if (System.IO.File.Exists("config.json")) config = JObject.Parse(System.IO.File.ReadAllText(@"config.json")); else { Console.WriteLine("config.json file not found! Unable to initialize Nekobot!"); SQL.CloseAndDispose(); Console.ReadKey(); Environment.Exit(0); } masterId = config["master"].ToObject<long>(); Music.Folder = config["musicFolder"].ToString(); Music.UseSubdirs = config["musicUseSubfolders"].ToObject<bool>(); string helpmode = config["helpmode"].ToString(); commands = new CommandService(new CommandServiceConfig { CommandChars = config["prefix"].ToString().ToCharArray(), RequireCommandCharInPrivate = config["prefixprivate"].ToObject<bool>(), RequireCommandCharInPublic = config["prefixpublic"].ToObject<bool>(), MentionCommandChar = config["mentioncommand"].ToObject<short>(), HelpMode = helpmode.Equals("public") ? HelpMode.Public : helpmode.Equals("private") ? HelpMode.Private : HelpMode.Disable }, Flags.GetNsfw, Flags.GetMusic, Flags.GetIgnored); version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); }