public static void Client_OnTextMessageReceived(object sender, IEnumerable <TextMessage> e) { foreach (TextMessage Message in e) { Color col = Color.White; if (Message.Target == TextMessageTargetMode.Private) { col = Color.LightGreen; } if (Message.Target == TextMessageTargetMode.Channel) { col = Color.Cyan; } ConsoleHelper.WriteEventLine(Message.InvokerName + ": " + Message.Message, col); if (Message.InvokerId != client.ClientId && Message.Message.Trim().StartsWith("!b")) { string[] ar = Message.Message.Split(new char[] { ' ' }, 2); string Msg = ar[1].TrimStart().Replace("[URL]", "").Replace("[/URL]", ""); ConsoleHelper.WriteEventLine("Executing: " + Msg, Color.Orange); new Task(() => { AsyncComHandler.HandleCommand(Msg, new Context(Message, client)); }).Start(); } } }
static void Main(string[] args) { ConsoleHelper.Start(); Console.OutputEncoding = System.Text.Encoding.UTF8; CommandHandler Handler = new CommandHandler(); AsyncComHandler.BeginHandler(Handler); Thread.Sleep(Timeout.Infinite); }
public void Execute(string Path) { string[] lines = File.ReadAllLines(Path); AsyncComHandler.execute(lines); }