public bool UnTrackChat(BotChat chat) { if (chat == null) { return(false); } lock (TrackedChats) { if (!TrackedChats.Contains(chat.Id)) { return(false); } TrackedChats.Remove(chat.Id); Core.Log.LibVerbose("Chat UnTracked"); OnTrackedChatsChanged?.Invoke(this, EventArgs.Empty); return(true); } }
public bool TrackChat(BotChat chat) { if (chat is null) { return(false); } lock (TrackedChats) { if (TrackedChats.Contains(chat.Id)) { return(false); } TrackedChats.Add(chat); Core.Log.LibVerbose("Chat Tracked"); _counterTrackedChat.Increment(); OnTrackedChatsChanged?.Invoke(this, EventArgs.Empty); return(true); } }
public bool IsChatTracked(BotChat chat) { lock (TrackedChats) return(chat != null && TrackedChats.Contains(chat.Id)); }