Пример #1
0
        private void _parseMessage(object sender, MessageEventArgs e)
        {
            string  jsonString = e.Data;
            JObject message    = JObject.Parse(jsonString);

            if (_isMessage(message) && !_isFromSelf(message))
            {
                OnMessage?.Invoke(this, new SlackMessage((string)message["text"],
                                                         _getUserFromId((string)message["user"])),
                                  _getChannelFromId((string)message["channel"]));
            }
            else if (_isChannelJoined(message))
            {
                SlackChannel channel = _getChannelFromId((string)message["channel"]["id"]);
                OnChannelJoined?.Invoke(this, channel);
            }
        }
Пример #2
0
        private void JoinedChannel(JObject message)
        {
            var channel = SlackBotAPI.GetChannelFromId((string)message[SlackMessageJSONProps.Channel]);

            OnChannelJoined?.Invoke(this, channel);
        }