public void RelayMessage(CChatRoom_IncomingChatMessage_Notification notification) { if (PipeStream != null && PipeStream.IsConnected) { string message = $"{{ 'sender': {notification.steamid_sender}, 'message': '{notification.message}' }}"; try { PipeStream.Write(encoding.GetBytes(message)); } catch (Exception e) { Debug.Write(e); } } //throw new NotImplementedException(); }
static void OnMethodResponse(SteamUnifiedMessages.ServiceMethodResponse callback) { if (callback.JobID == myJobID) { // always double check the jobid of the response to ensure you're matching to your original request ProcessMyJob(callback); return; } if (callback.ServiceName == "ChatRoomClient" && callback.RpcName == "NotifyIncomingChatMessage") { CChatRoom_IncomingChatMessage_Notification incomingChatMessage = callback.GetDeserializedResponse <CChatRoom_IncomingChatMessage_Notification>(); Console.WriteLine($"from: {incomingChatMessage.steamid_sender}\n message : {incomingChatMessage.message} \n"); } }
private static async Task OnIncomingChatMessage(CChatRoom_IncomingChatMessage_Notification notification) { Console.WriteLine($"from: {notification.steamid_sender}\n message : {notification.message} \n"); if (notification.message == "ping") { CChatRoom_SendChatMessage_Request request = new CChatRoom_SendChatMessage_Request { chat_group_id = notification.chat_group_id, chat_id = notification.chat_id, message = "pong" }; await chatRoomService.SendMessage(x => x.SendChatMessage(request)); } pipeHandler.RelayMessage(notification); }
private void OnServiceMethod(SteamUnifiedMessages.ServiceMethodNotification callback) { Log.WriteInfo("Bridge", $"{callback.MethodName}"); switch (callback.MethodName) { //ge: ChatRoomClient.NotifyIncomingChatMessage#1 case "ChatRoomClient.NotifyIncomingChatMessage#1": CChatRoom_IncomingChatMessage_Notification body = (CChatRoom_IncomingChatMessage_Notification)callback.Body; Log.WriteDebug("Bridge", $"({body.chat_group_id}-{body.chat_id}), <{body.steamid_sender}> {body.message}"); if (body.chat_group_id == 17013 && body.chat_id == 289194) { IRC.Instance.Send("#test", $"<{body.steamid_sender}> {body.message}"); } // else //{ // IRC.Instance.Send("#test", $"Elsewhere({body.chat_group_id}-{body.chat_id}), <{body.steamid_sender}> {body.message}"); //} break; } }
static void OnIncomingChatMessage_Notification(CChatRoom_IncomingChatMessage_Notification obj) { }