Guest User

Untitled

a guest
Jun 12th, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.67 KB | None | 0 0
  1.     class Threadtest
  2.  
  3.       include Cinch::Plugin
  4.       listen_to :hooktest, :method => :hooktest
  5.       match /threadtest nojoin/, :method => :test_nojoin
  6.       match /threadtest join/, :method => :test_join
  7.  
  8.       def test_join(m)
  9.         m.reply "Dispatching"
  10.         t = bot.handlers.dispatch(:hooktest, m)
  11.         t.each do |thread|
  12.           thread.join
  13.         end
  14.         m.reply "Done"
  15.       end
  16.  
  17.       def test_nojoin(m)
  18.         m.reply "Dispatching"
  19.         bot.handlers.dispatch(:hooktest, m)
  20.         m.reply "Done"
  21.       end
  22.  
  23.       def hooktest(m)
  24.         m.reply "Hook fired"
  25.         sleep 5
  26.         m.reply "Hook finished firing"
  27.       end
  28.  
  29.     end
Advertisement
Add Comment
Please, Sign In to add comment