public override void SendMessage(ChatMessage message) { if (Chat.IsAnonymous || String.IsNullOrWhiteSpace(message.Channel) || String.IsNullOrWhiteSpace(message.FromUserName) || String.IsNullOrWhiteSpace(message.Text)) { return; } HitboxWebSocketPacket jsonMessage = new HitboxWebSocketPacket() { name = "message", args = new List <HitboxArg>() { new HitboxArg() { method = "chatMsg", @params = new { channel = message.Channel.Replace("#", ""), name = message.FromUserName, nameColor = "B404AE", text = message.Text, } } } }; webSocket.Send("5:::" + JsonConvert.SerializeObject(jsonMessage)); }
private void SendUserListRequest(string channel) { var hitboxPacket = new HitboxWebSocketPacket() { name = "message", args = new List <HitboxArg>() { new HitboxArg() { method = "getChannelUserList", @params = new { channel = channel.Replace("#", ""), } } } }; var jsonString = JsonConvert.SerializeObject(hitboxPacket); webSocket.Send("5:::" + jsonString); }
private void SendCredentials(string nickname, string channel, string authToken) { var loginData = new HitboxWebSocketPacket() { name = "message", args = new List <HitboxArg>() { new HitboxArg() { method = "joinChannel", @params = new { channel = channel.Replace("#", ""), name = Chat.NickName, token = Chat.IsAnonymous ? "" : authToken ?? "", isAdmin = !Chat.IsAnonymous && channel.Replace("#", "").Equals(nickname, StringComparison.InvariantCultureIgnoreCase) ? true :false, } } } }; var jsonString = JsonConvert.SerializeObject(loginData); webSocket.Send("5:::" + jsonString); }