/// <summary> /// Performs the initial Slack integration. /// </summary> public void StartIntegration() { client = new SlackSocketClient(Token); client.Connect((loginResponse) => { Connected.Invoke(this, null); client.OnMessageReceived += (obj) => { SlackMessageEventArgs e = new SlackMessageEventArgs { Text = obj.text, Member = new SlackMember(GetUserByName(obj.user)) }; e.Channel = GetChannelByName(obj.channel) == null ? new SlackChannel(e.Member.Name, obj.channel) : new SlackChannel(GetChannelByName(obj.channel)); if (e.Text.Contains($"<@{client.MySelf.id}>")) { MentionReceived?.Invoke(this, e); } else { MessageReceived?.Invoke(this, e); } }; }, () => { //socket connected }); }
/// <summary> /// Performs the initial Slack integration. /// </summary> public void StartIntegration() { client = new SlackSocketClient (Token); client.Connect ((loginResponse) => { Connected.Invoke(this, null); client.OnMessageReceived += (obj) => { SlackMessageEventArgs e = new SlackMessageEventArgs { Text = obj.text, Member = new SlackMember(GetUserByName(obj.user)) }; e.Channel = GetChannelByName(obj.channel) == null ? new SlackChannel(e.Member.Name, obj.channel) : new SlackChannel(GetChannelByName(obj.channel)); if (e.Text.Contains($"<@{client.MySelf.id}>")) MentionReceived?.Invoke(this, e); else MessageReceived?.Invoke(this, e); }; }, () => { //socket connected }); }