private void UpdateChannelInfo(Channel channel) { this.Logger.Debug($"Init {(channel.is_channel ? "channel" : "group")} {this.GetReadableName(channel.id)}"); // Search in unread history for mentions if (channel.unread_count > 0) { using (ManualResetEventSlim waiter = new ManualResetEventSlim()) { this.GetHistoryMethod(channel)( x => { this.channelsInfo[channel].UnreadMessage = x.messages.Count(this.IsRegularMessage); this.channelsInfo[channel].UnreadMention = x.messages.Count(y => this.IsRegularMessage(y) && this.HasMention(this.GetRawMessage(y))); waiter.Set(); }, channel, null, null, channel.unread_count); waiter.Wait(Timeout); } } }
private bool ShouldMonitor(Channel channel) { return channel.is_archived == false && ((channel.is_channel && channel.is_member) || channel.is_group); }
private GetHistoryHandler GetHistoryMethod(Channel channel) { return channel.is_channel ? (GetHistoryHandler)this.Client.GetChannelHistory : (GetHistoryHandler)this.Client.GetGroupHistory; }
public ChannelAdapter(Channel info, ConnectedInterface connected, SlackClient client) { this.info = info; this.connected = connected; this.client = client; }
public Task <GroupMessageHistory> GetGroupHistoryAsync(Channel groupInfo, DateTime?latest = null, DateTime?oldest = null, int?count = null) { return(GetHistoryAsync <GroupMessageHistory>(groupInfo.id, latest, oldest, count)); }
public Task <ChannelMessageHistory> GetChannelHistoryAsync(Channel channelInfo, DateTime?latest = null, DateTime?oldest = null, int?count = null) { return(GetHistoryAsync <ChannelMessageHistory>(channelInfo.id, latest, oldest, count)); }