Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.14 KB | None | 0 0
  1.                 if (strlen($content) > 1800) {
  2.                     $messageSplit[1] = htmlspecialchars_decode(trim($messageSplit[1]));
  3.                     $channel->sendMessage($messageSplit[1], false)->then(
  4.                             function (){ //code on completion
  5.                                 unset($messageSplit[0]);
  6.                                 unset($messageSplit[1]);
  7.                                 array_values($messageSplit);
  8.                                 SendQueued($channel, $messageSplit);
  9.  
  10.                         },
  11.                             function ($reason){
  12.                                 //process exception
  13.                             }
  14.                         );
  15.                     if (DEBUG) { $this->logger->addInfo("Debug MSG:009-0-2 fCheckMails_for{$keyID}-msg2: {$messageSplit[1]}"); }
  16.                 }
  17.  
  18. //add function somewhere
  19. /**
  20.  * Sends messages in queue waiting for previous to send (hopefully x) )
  21.  * @param $channel channel to send to
  22.  * @param $msg     message text
  23.  */
  24. function SendQueued($channel, $msg){
  25. $channel->sendMessage($msg[0])->then(
  26.        
  27.         function (){ //code on completion
  28.             unset($msg[0]);
  29.             array_values($msg);
  30.             if(count($messageSplit)>0) return SendQueued($channel, $messageSplit);
  31.     },
  32.         function ($reason){
  33.             //process exception
  34.         }
  35.     );
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement