From 659eee1567f3274042467ebc1dce78ee9c379b60 Mon Sep 17 00:00:00 2001 From: TriggerAu Date: Wed, 16 Oct 2019 20:13:28 +1100 Subject: [PATCH 1/2] Remove "user_typing" from Typing Routes (Fixes #203) user_typing appears to be the event type for when a user is typing in a channel, and this class is being used to send the I am typing message - whose type is "typing" --- SlackAPI/WebSocketMessages/Typing.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/SlackAPI/WebSocketMessages/Typing.cs b/SlackAPI/WebSocketMessages/Typing.cs index 2979409..0917e4f 100644 --- a/SlackAPI/WebSocketMessages/Typing.cs +++ b/SlackAPI/WebSocketMessages/Typing.cs @@ -3,7 +3,6 @@ namespace SlackAPI.WebSocketMessages { [SlackSocketRouting("typing")] - [SlackSocketRouting("user_typing")] public class Typing : SlackSocketMessage { public string user; From a96b0342d7581a7b4802c28630f59e3d82cb8b1a Mon Sep 17 00:00:00 2001 From: TriggerAu Date: Wed, 16 Oct 2019 20:14:55 +1100 Subject: [PATCH 2/2] Add UserTyping class and hookup action for user_typing event (Relates #203) filled in/renamed the UserTyping method so it matches the reaction/message ones. This now receives the events when a user is typing in a channel --- SlackAPI/SlackSocketClient.cs | 6 ++++-- SlackAPI/WebSocketMessages/UserTyping.cs | 11 +++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 SlackAPI/WebSocketMessages/UserTyping.cs diff --git a/SlackAPI/SlackSocketClient.cs b/SlackAPI/SlackSocketClient.cs index 5aff2a3..fa8202f 100644 --- a/SlackAPI/SlackSocketClient.cs +++ b/SlackAPI/SlackSocketClient.cs @@ -12,6 +12,7 @@ public class SlackSocketClient : SlackClient public event Action OnMessageReceived; public event Action OnReactionAdded; public event Action OnPongReceived; + public event Action OnUserTyping; bool HelloReceived; public const int PingInterval = 3000; @@ -203,9 +204,10 @@ public void HandleGroupRename(GroupRename rename) GroupLookup[rename.channel.id].created = rename.channel.created; } - public void UserTyping(Typing t) + public void HandleUserTyping(UserTyping userTyping) { - + if (OnUserTyping != null) + OnUserTyping(userTyping); } public void Message(NewMessage m) diff --git a/SlackAPI/WebSocketMessages/UserTyping.cs b/SlackAPI/WebSocketMessages/UserTyping.cs new file mode 100644 index 0000000..5d44c81 --- /dev/null +++ b/SlackAPI/WebSocketMessages/UserTyping.cs @@ -0,0 +1,11 @@ +using System; + +namespace SlackAPI.WebSocketMessages +{ + [SlackSocketRouting("user_typing")] + public class UserTyping : SlackSocketMessage + { + public string user; + public string channel; + } +}