Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.72 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.             saveProcessedMessageId(inc.update_id + 1);
  9.  
  10.             if(inc.chatId == -1)
  11.                 continue;
  12.  
  13.             auto chat = createChat(inc);
  14.  
  15.             if(!inc.message.isNull)
  16.                 upsertSubscriber(inc.message.chat.id, inc.message.from);
  17.  
  18.             try
  19.                 chat.dispatch();
  20.             catch(TelegramBotApiException ex)
  21.             {
  22.                 logError("TelegramBotApiException: "~ex.msg);
  23.             }
  24.         }
  25.  
  26.         destroy(incoming);
  27.  
  28.         //~ yield();
  29.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement