private void OnMqMessageReceived(object model, BasicDeliverEventArgs ea) { Console.WriteLine("Message Received from Mq"); var body = ea.Body; var message = Encoding.UTF8.GetString(body); var messageObj = JsonConvert.DeserializeObject <MqMessage>(message); var tasks = new List <Task>(); foreach (long receiverId in messageObj.Receivers) { tasks.Add(telegramContext.SendMessage(messageObj.Content, receiverId)); } Task.WaitAll(tasks.ToArray()); }
public override async void SendResponse(TelegramContext telegramContext) { await telegramContext.SendMessage(ResponseText, ChatId); }