Advertisement
Guest User

Untitled

a guest
May 22nd, 2017
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. plugin.id = "thanks-mode";
  2.  
  3. plugin.init =
  4. function _init( glob ) {
  5. plugin.major = 1;
  6. plugin.minor = 2;
  7. plugin.version = plugin.major + "." + plugin.minor;
  8. plugin.description = "Thanks for mode. " +
  9. "By MakOke <gboxlan@gmail.com>";
  10.  
  11. return "OK";
  12. }
  13.  
  14. plugin.enable =
  15. function _enable() {
  16. client.eventPump.addHook( [{set:"channel", type:"chanmode"}], modoHook, "modoHook" );
  17. return true;
  18. }
  19.  
  20. plugin.disable =
  21. function _disable() {
  22. client.eventPump.removeHookByName( "modoHook" );
  23. return true;
  24. }
  25.  
  26. function modoHook( e ) {
  27. if( e.modeStr[0] == '+' ) {
  28. var str = '';
  29. for( var i = 1; i < e.modeStr.length; i++ )
  30. if( e.server.me.encodedName == e.usersAffected[i-1].encodedName ) {
  31. switch( e.modeStr[i] ) {
  32. case 'q':
  33. str += '~';
  34. break;
  35. case 'a':
  36. str += '&';
  37. break;
  38. case 'o':
  39. str += '@';
  40. break;
  41. case 'h':
  42. str += '%';
  43. break;
  44. case 'v':
  45. str += '+';
  46. break;
  47. }
  48. }
  49. if( str )
  50. setTimeout( function() {
  51. e.channel.dispatch( 'me Thanks for ' + str + ' ' + e.user.encodedName + ' !!' );
  52. }, 5 * 1000 );
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement