protected async Task Received(string Name, Result result) { AliasString Key = Commands.Keys.Where(x => x.Contains(Name)).First(); if (Key != null) { Logger.WriteLog("Received Command {0} Parameter {1}", result.args[0], string.Join(" ", result.args.Skip(1).ToArray())); await Commands[Key].CallAsync(result); } }
protected void RegisterCommand(string[] Name, string Description, Action <Result> command) { AliasString Key = new AliasString(Name); if (!CurrentCommands.ContainsKey(Key)) { CurrentCommands.Add(Key, new Command() { Name = Key, Description = Description, command = command }); } else { throw new InvalidOperationException("이미 명령어가 추가되어있습니다."); } }