public async Task SendPrivateMessageTest() { InitializeDatastore.Run(); var client = new WebSocketClient(PrivateConstants.BotWebsocketAuth); client.Run(new MessageProcessor(client)); await Task.Delay(5000); client.Visit(new PrivateMessage("dharmatest", "test message")); }
public async Task SendMessageTest() { InitializeDatastore.Run(); var client = new WebSocketClient(PrivateConstants.TestAccountWebsocketAuth); client.Run(new MessageProcessor(client)); await Task.Delay(2000); client.Send(new PublicMessage($"test{Tools.RandomString(3)}")); }
public async Task SendPermBanTest() { InitializeDatastore.Run(); var client = new WebSocketClient(PrivateConstants.BotWebsocketAuth); client.Run(new MessageProcessor(client)); await Task.Delay(5000); client.Visit(new Ban("dharmatest", TimeSpan.FromMinutes(-1), "perm reason")); }
static void Main(string[] args) { var firstArg = args.FirstOrDefault(); if (string.IsNullOrWhiteSpace(firstArg)) { Console.WriteLine("Select a client:"); Console.WriteLine(""); Console.WriteLine("gg = destiny.gg"); Console.WriteLine("ggl = destiny.gg listening only"); Console.WriteLine("t = twitch.tv"); Console.WriteLine("tl = twitch.tv listening only"); Console.WriteLine("s = sample client"); firstArg = Console.ReadLine(); } IClientVisitor client; switch (firstArg) { case "gg": client = new WebSocketClient(PrivateConstants.BotWebsocketAuth); break; case "ggl": client = new WebSocketListenerClient(PrivateConstants.BotWebsocketAuth); break; case "t": client = new SimpleIrcClient(server, port, channel, nick, pass); break; case "tl": client = new SimpleIrcListenerClient(server, port, channel, nick, pass); break; case "s": client = new SampleClient(); break; default: throw new Exception("Invalid input"); } new PrimaryLogic(client).Run(); }
/// <summary> /// OnStart(): Put startup code here /// - Start threads, get inital data, etc. /// </summary> /// <param name="args"></param> protected override void OnStart(string[] args) { const string folderName = "Logs"; var fileNamePath = $"{folderName}//{DateTime.UtcNow.Date.ToString("yyyy-MM-dd")}error.txt"; var exists = Directory.Exists(folderName); if (!exists) Directory.CreateDirectory(folderName); using (var writer = new StreamWriter(fileNamePath)) { writer.AutoFlush = true; try { var client = new WebSocketClient(PrivateConstants.BotWebsocketAuth); new PrimaryLogic(client).Run(); } catch (Exception e) { var sb = new StringBuilder(); WriteExceptionDetails(e, sb, 0); writer.WriteLine(sb.ToString()); Logger.ErrorLog(e); } } base.OnStart(args); }