Advertisement
Guest User

Untitled

a guest
Dec 19th, 2018
463
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.40 KB | None | 0 0
  1. private ChatWithBot[long] chats;
  2.  
  3. ChatWithBot createChat(Update u)
  4. {
  5.     const chatId = u.chatId;
  6.     ChatWithBot ret;
  7.  
  8.     ChatWithBot* found = (chatId in chats);
  9.  
  10.     if(found is null)
  11.     {
  12.         ret = new ChatWithBot(u);
  13.         chats[chatId] = ret;
  14.     }
  15.     else
  16.     {
  17.         ret = *found;
  18.         import std.stdio; writeln(ret);
  19.         ret.incUpdate(u);
  20.     }
  21.  
  22.     return ret;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement