예제 #1
0
        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());
        }
예제 #2
0
 public override async void SendResponse(TelegramContext telegramContext)
 {
     await telegramContext.SendMessage(ResponseText, ChatId);
 }