Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.76 KB | None | 0 0
  1.     while(true)
  2.     {
  3.         const savedMsgId = readVariable("latestMsgId").to!int;
  4.         auto incoming = connection.getUpdates(savedMsgId, 30);
  5.  
  6.         foreach(ref inc; incoming)
  7.         {
  8.             if(inc.chatId != -1)
  9.             {
  10.                 auto chat = createChat(inc);
  11.  
  12.                 if(!inc.message.isNull)
  13.                     upsertSubscriber(inc.message.chat.id, inc.message.from);
  14.  
  15.                 try
  16.                     chat.dispatch();
  17.                 catch(TelegramBotApiException ex)
  18.                 {
  19.                     logError("TelegramBotApiException: "~ex.msg);
  20.                 }
  21.             }
  22.  
  23.             saveProcessedMessageId(inc.update_id + 1);
  24.         }
  25.  
  26.         destroy(incoming);
  27.  
  28.         //~ yield();
  29.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement