Guest User

Untitled

a guest
Feb 20th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. <?php
  2.  
  3. class Plugin_Threads extends Plugin {
  4.    
  5.     public $triggers = array('!threadz');
  6.    
  7.     function isTriggered() {
  8.         if(!isset($this->data['text'])) {
  9.             $this->reply('Some data plox');
  10.             return;
  11.         }
  12.        
  13.         $this->reply("Ok, I'm doing your super long lasting command with input '".$this->data['text']."' now. I'll report back when it's finished.");
  14.         $this->addJob($this->data['text']);
  15.     }
  16.    
  17.     function onJobDone() {
  18.         $this->reply('Good news everyone, I processed '.$this->User->nick.'\'s input as fast as I could and here is the result: '.$this->data['result']);
  19.     }
  20.    
  21.     function doJob($data) {
  22.         sleep(10);
  23.     return strrev($data);
  24.     }
  25.    
  26. }
  27.  
  28. ?>
Add Comment
Please, Sign In to add comment