public async Task SendTypingAsync(BotChat chat) { if (!IsConnected) { return; } Core.Log.LibVerbose("Sending typing notification. ChatId = {0}", chat?.Id); await Transport.SendTypingAsync(chat).ConfigureAwait(false); }
public async Task SendPhotoMessageAsync(BotChat chat, Stream fileStream, string caption = null) { if (!IsConnected) { return; } Core.Log.LibVerbose("Sending photo message. ChatId = {0}, Caption = {1}", chat?.Id, caption); await Transport.SendPhotoMessageAsync(chat, fileStream, caption).ConfigureAwait(false); }
public async Task SendTextMessageAsync(BotChat chat, string message, MessageParseMode parseMode = MessageParseMode.Default) { if (!IsConnected) { return; } Core.Log.LibVerbose("Sending text message. ChatId = {0}, Message = {1}", chat?.Id, message); await Transport.SendTextMessageAsync(chat, message, parseMode).ConfigureAwait(false); Core.Log.LibVerbose("Message sent."); }
public async Task SendPhotoMessageAsync(BotChat chat, string fileName, string caption = null) { if (!IsConnected) { return; } Core.Log.LibVerbose("Sending photo message. ChatId = {0}, FileName = {1}, Caption = {2}", chat?.Id, fileName, caption); await Transport.SendPhotoMessageAsync(chat, fileName, caption).ConfigureAwait(false); _counterMessagesSent.Increment(); }
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)); }