private void executeCommand(string command, string[] args) { if (Commands.ContainsKey(command)) { Commands[command].Action(args); } else { LoggerService.LogInfo($"Command {command} not found! Type 'help' for a list of commands"); } }
private void buildCommandsList() { Enums = Assembly.GetAssembly(typeof(LimitOrder))?.GetTypes().Where(t => t.IsEnum). ToDictionary(x => x.ToString().Split('.').Last(), x => x); foreach (var item in Enums) { LoggerService.LogTrace(item.ToString()); } LoggerService.LogInfo("Building Commands"); // this will get us the current assembly processAssembly(Assembly.GetAssembly(typeof(CommandService))); // Maintain the sorted command list foreach (var command in Commands) { Sorted.Add(command.Key); } Sorted.Sort(); }
public async Task Run() { var clock = await TradingClient.GetClockAsync(); string openStr; if (clock.IsOpen) { openStr = "Markets are currently open"; } else { openStr = "Markets are currently closed"; } LoggerService.LogInfo($"Bot is ready..."); LoggerService.LogInfo($"[{openStr}] Type a command to start."); CommandService.Listen(); await Task.WhenAll(RunningTasks); }