prashantdwivedi

Adding Users [eggdrop] tcl script

Jan 11th, 2014
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 16.32 KB | None | 0 0
  1. # Default trigger set to !
  2.  
  3. # Commands are:
  4. # !addowner nickname
  5. # !addmaster nickname
  6. # !addgop nickname
  7. # !addchanowner nickname
  8. # !addsop nickname
  9. # !delsop nickname
  10. # !addaop nickname
  11. # !delaop nickname
  12. # !addaov nickname
  13. # !delaov nickname
  14.  
  15. # JoinModes Public Commands:
  16. # Enable:  !joinmodes on
  17. # Disable: !joinmodes off
  18.  
  19. # JoinModes Message Command:
  20. # /msg botnick joinmodes #channel on/off
  21.  
  22. # -----------EDIT BELOW------------
  23.  
  24. # Set this to whatever trigger you like.
  25. set trigger "!"
  26.  
  27. # ------DONT TOUCH BELOW HERE!!!------
  28. setudef flag joinmode
  29.  
  30. proc getTrigger {} {
  31.   global trigger
  32.   return $trigger
  33. }
  34.  
  35. bind join - * join:modes
  36. bind pub - ${trigger}addowner addowner:pub
  37. bind pub - ${trigger}addmaster addmaster:pub
  38. bind pub - ${trigger}addgop addgop:pub
  39. bind pub - ${trigger}addchanowner addcowner:pub
  40. bind pub - ${trigger}addsop addsop:pub
  41. bind pub - ${trigger}delsop delsop:pub
  42. bind pub - ${trigger}addaop addaop:pub
  43. bind pub - ${trigger}delaop delaop:pub
  44. bind pub - ${trigger}addaov addaov:pub
  45. bind pub - ${trigger}delaov delaov:pub
  46. bind pub - ${trigger}joinmodes jmode:pub
  47. bind msg - joinmodes jmode:msg
  48.  
  49. proc addowner:pub {nick uhost hand chan arg} {
  50.   if {![matchattr [nick2hand $nick] n]} {return}
  51.   set owneradd [lindex [split $arg] 0]
  52.   if {([lindex [split $arg] 0] == "") && (![regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getTrigger]addowner nickname"; return}
  53.   if {([lindex [split $arg] 0] == "") && ([regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :ERROR: Incorrect Parameters. SYNTAX: [getTrigger]addowner nickname"; return}
  54.   if {[validuser [nick2hand $owneradd]] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: $owneradd is already a valid user."; return}
  55.   if {[validuser [nick2hand $owneradd]] && [regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: $owneradd is already a valid user."; return}
  56.   if {![onchan $owneradd $chan] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: $owneradd is not even on $chan ..."; return}
  57.   if {![onchan $owneradd $chan] && [regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: $owneradd is not even on $chan ..."; return}
  58.   set mask *!*@[lindex [split [getchanhost $owneradd $chan] @] 1]
  59.   adduser $owneradd $mask
  60.   chattr $owneradd +n
  61.   putquick "NOTICE $nick :Added $owneradd to the Global Owner List."
  62.   putquick "NOTICE $owneradd :$nick ($hand) has added you to the Global Owner List."
  63. }
  64.  
  65. proc addmaster:pub {nick uhost hand chan arg} {
  66.   if {![matchattr [nick2hand $nick] n]} {return}
  67.   set masteradd [lindex [split $arg] 0]
  68.   if {([lindex [split $arg] 0] == "") && (![regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getTrigger]addmaster nickname"; return}
  69.   if {([lindex [split $arg] 0] == "") && ([regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :ERROR: Incorrect Parameters. SYNTAX: [getTrigger]addmaster nickname"; return}
  70.   if {[validuser [nick2hand $masteradd]] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: $masteradd is already a valid user."; return}
  71.   if {[validuser [nick2hand $masteradd]] && [regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: $masteradd is already a valid user."; return}
  72.   if {![onchan $masteradd $chan] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: $masteradd is not even on $chan ..."; return}
  73.   if {![onchan $masteradd $chan] && [regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: $masteradd is not even on $chan ..."; return}
  74.   set mask *!*@[lindex [split [getchanhost $masteradd $chan] @] 1]
  75.   adduser $masteradd $mask
  76.   chattr $masteradd +m
  77.   putquick "NOTICE $nick :Added $masteradd to the Global Master List."
  78.   putquick "NOTICE $masteradd :$nick ($hand) has added you to the Global Master List."
  79. }
  80.  
  81. proc addgop:pub {nick uhost hand chan arg} {
  82.   if {![matchattr [nick2hand $nick] m]} {return}
  83.   set gopadd [lindex [split $arg] 0]
  84.   if {([lindex [split $arg] 0] == "") && (![regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getTrigger]addgop nickname"; return}
  85.   if {([lindex [split $arg] 0] == "") && ([regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :ERROR: Incorrect Parameters. SYNTAX: [getTrigger]addgop nickname"; return}
  86.   if {[validuser [nick2hand $gopadd]] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: $gopadd is already a valid user."; return}
  87.   if {[validuser [nick2hand $gopadd]] && [regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: $gopadd is already a valid user."; return}
  88.   if {![onchan $gopadd $chan] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: $gopadd is not even on $chan ..."; return}
  89.   if {![onchan $gopadd $chan] && [regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: $gopadd is not even on $chan ..."; return}
  90.   set mask *!*@[lindex [split [getchanhost $gopadd $chan] @] 1]
  91.   adduser $gopadd $mask
  92.   chattr $gopadd +o
  93.   putquick "NOTICE $nick :Added $gopadd to the Global OP List."
  94.   putquick "NOTICE $gopadd :$nick ($hand) has added you to the Global OP List."
  95. }
  96.  
  97. proc addcowner:pub {nick uhost hand chan arg} {
  98.   if {![matchattr [nick2hand $nick] o]} {return}
  99.   set cowneradd [lindex [split $arg] 0]
  100.   if {([lindex [split $arg] 0] == "") && (![regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getTrigger]addchanowner nickname"; return}
  101.   if {([lindex [split $arg] 0] == "") && ([regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :ERROR: Incorrect Parameters. SYNTAX: [getTrigger]addchanowner nickname"; return}
  102.   if {[validuser [nick2hand $cowneradd]] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: $cowneradd is already a valid user."; return}
  103.   if {[validuser [nick2hand $cowneradd]] && [regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: $cowneradd is already a valid user."; return}
  104.   if {![onchan $cowneradd $chan] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: $cowneradd is not even on $chan ..."; return}
  105.   if {![onchan $cowneradd $chan] && [regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: $cowneradd is not even on $chan ..."; return}
  106.   set mask *!*@[lindex [split [getchanhost $cowneradd $chan] @] 1]
  107.   adduser $cowneradd $mask
  108.   chattr $cowneradd |n $chan
  109.   putquick "NOTICE $nick :Added $cowneradd to the Channel Owner List for $chan"
  110.   putquick "NOTICE $cowneradd :$nick ($hand) has added you to the Channel Owner List for $chan"
  111. }
  112.  
  113. proc addsop:pub {nick uhost hand chan arg} {
  114.   if {![matchattr [nick2hand $nick] o|n $chan]} {return}
  115.   set sopadd [lindex [split $arg] 0]
  116.   if {([lindex [split $arg] 0] == "") && (![regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getTrigger]addsop nickname"; return}
  117.   if {([lindex [split $arg] 0] == "") && ([regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :ERROR: Incorrect Parameters. SYNTAX: [getTrigger]addsop nickname"; return}
  118.   if {[validuser [nick2hand $sopadd]] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: $sopadd is already a valid user."; return}
  119.   if {[validuser [nick2hand $sopadd]] && [regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: $sopadd is already a valid user."; return}
  120.   set mask *!*@[lindex [split [getchanhost $sopadd $chan] @] 1]
  121.   putquick "MODE $chan +o $sopadd"
  122.   adduser $sopadd $mask
  123.   chattr $sopadd |+m $chan
  124.   putquick "NOTICE $nick :Added $sopadd to the SOP List for $chan"
  125.   putquick "NOTICE $sopadd :$nick ($hand) has added you to the SOP List for $chan"
  126. }
  127.  
  128. proc delsop:pub {nick uhost hand chan arg} {
  129.   if {![matchattr [nick2hand $nick] o|n $chan]} {return}
  130.   set sopdel [lindex [split $arg] 0]
  131.   if {([lindex [split $arg] 0] == "") && (![regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getTrigger]delsop nickname"; return}
  132.   if {([lindex [split $arg] 0] == "") && ([regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :ERROR: Incorrect Parameters. SYNTAX: [getTrigger]delsop nickname"; return}
  133.   if {![validuser [nick2hand $sopdel]] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: $sopdel is not a valid user."; return}
  134.   if {![validuser [nick2hand $sopdel]] && [regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: $sopdel is not a valid user."; return}
  135.   putquick "MODE $chan -o $sopdel"
  136.   deluser $sopdel
  137.   putquick "NOTICE $nick :Deleted $sopdel from the SOP List for $chan"
  138.   putquick "NOTICE $sopdel :$nick ($hand) has deleted you from the SOP List for $chan"
  139. }
  140.  
  141. proc addaop:pub {nick uhost hand chan arg} {
  142.   if {![matchattr [nick2hand $nick] o|m $chan]} {return}
  143.   set opadd [lindex [split $arg] 0]
  144.   if {([lindex [split $arg] 0] == "") && (![regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getTrigger]addaop nickname"; return}
  145.   if {([lindex [split $arg] 0] == "") && ([regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :ERROR: Incorrect Parameters. SYNTAX: [getTrigger]addaop nickname"; return}
  146.   if {[validuser [nick2hand $opadd]] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: $opadd is already a valid user."; return}
  147.   if {[validuser [nick2hand $opadd]] && [regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: $opadd is already a valid user."; return}
  148.   set mask *!*@[lindex [split [getchanhost $opadd $chan] @] 1]
  149.   putquick "MODE $chan +o $opadd"
  150.   adduser $opadd $mask
  151.   chattr $opadd |+o $chan
  152.   putquick "NOTICE $nick :Added $opadd to the AOP List for $chan"
  153.   putquick "NOTICE $opadd :$nick ($hand) has added you to the AOP List for $chan"
  154. }
  155.  
  156. proc delaop:pub {nick uhost hand chan arg} {
  157.   if {![matchattr [nick2hand $nick] o|m $chan]} {return}
  158.   set opdel [lindex [split $arg] 0]
  159.   if {([lindex [split $arg] 0] == "") && (![regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getTrigger]delaop nickname"; return}
  160.   if {([lindex [split $arg] 0] == "") && ([regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :ERROR: Incorrect Parameters. SYNTAX: [getTrigger]delaop nickname"; return}
  161.   if {![validuser [nick2hand $opdel]] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: $opdel is not a valid user."; return}
  162.   if {![validuser [nick2hand $opdel]] && [regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: $opdel is not a valid user."; return}
  163.   putquick "MODE $chan -o $opdel"
  164.   deluser $opdel
  165.   putquick "NOTICE $nick :Deleted $opdel from the AOP List for $chan"
  166.   putquick "NOTICE $opdel :$nick ($hand) has deleted you from the AOP List for $chan"
  167. }
  168.  
  169. proc addaov:pub {nick uhost hand chan arg} {
  170.   if {![matchattr [nick2hand $nick] o|o $chan]} {return}
  171.   set aovadd [lindex [split $arg] 0]
  172.   if {([lindex [split $arg] 0] == "") && (![regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getTrigger]addaov nickname"; return}
  173.   if {([lindex [split $arg] 0] == "") && ([regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :ERROR: Incorrect Parameters. SYNTAX: [getTrigger]addaov nickname"; return}
  174.   if {[validuser [nick2hand $aovadd]] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: $aovadd is already a valid user."; return}
  175.   if {[validuser [nick2hand $aovadd]] && [regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: $aovadd is already a valid user."; return}
  176.   set mask *!*@[lindex [split [getchanhost $aovadd $chan] @] 1]
  177.   putquick "MODE $chan +v $aovadd"
  178.   adduser $aovadd $mask
  179.   chattr $aovadd |+v $chan
  180.   putquick "NOTICE $nick :Added $aovadd to the AOV List for $chan"
  181.   putquick "NOTICE $aovadd :$nick ($hand) has added you to the AOV List for $chan"
  182. }
  183.  
  184. proc delaov:pub {nick uhost hand chan arg} {
  185.   if {![matchattr [nick2hand $nick] o|o $chan]} {return}
  186.   set aovdel [lindex [split $arg] 0]
  187.   if {([lindex [split $arg] 0] == "") && (![regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getTrigger]delaov nickname"; return}
  188.   if {([lindex [split $arg] 0] == "") && ([regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :ERROR: Incorrect Parameters. SYNTAX: [getTrigger]delaov nickname"; return}
  189.   if {![validuser [nick2hand $aovdel]] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: $aovdel is not a valid user."; return}
  190.   if {![validuser [nick2hand $aovdel]] && [regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: $aovdel is not a valid user."; return}
  191.   putquick "MODE $chan -v $aovdel"
  192.   deluser $aovdel
  193.   putquick "NOTICE $nick :Deleted $aovdel from the AOV List for $chan"
  194.   putquick "NOTICE $aovdel :$nick ($hand) has deleted you from the AOV List for $chan"
  195. }
  196.  
  197. proc jmode:pub {nick uhost hand chan arg} {
  198.   if {![matchattr [nick2hand $nick] o|n $chan]} {return}
  199.   if {([lindex [split $arg] 0] == "") && (![regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getTrigger]joinmodes on/off"; return}
  200.   if {([lindex [split $arg] 0] == "") && ([regexp c [getchanmode $chan]])} {putquick "PRIVMSG $chan :ERROR: Incorrect Parameters. SYNTAX: [getTrigger]joinmodes on/off"; return}
  201.  
  202.   if {[lindex [split $arg] 0] == "on"} {
  203.     if {[channel get $chan joinmode] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: This setting is already enabled."; return}
  204.     if {[channel get $chan joinmode] && [regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: This setting is already enabled."; return}
  205.     channel set $chan +joinmode
  206.     putquick "PRIVMSG $chan :Enabled Auto @/+ Modes for $chan"
  207.   }
  208.  
  209.   if {[lindex [split $arg] 0] == "off"} {
  210.     if {![channel get $chan joinmode] && ![regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :\037ERROR\037: This setting is already disabled."; return}
  211.     if {![channel get $chan joinmode] && [regexp c [getchanmode $chan]]} {putquick "PRIVMSG $chan :ERROR: This setting is already disabled."; return}
  212.     channel set $chan -joinmode
  213.     puthelp "PRIVMSG $chan :Disabled Auto @/+ Modes for $chan"
  214.   }
  215. }
  216.  
  217. proc jmode:msg {nick uhost hand arg} {
  218.   global botnick
  219.   set chan [strlwr [lindex $arg 0]]
  220.   if {![matchattr [nick2hand $nick] o|n $chan]} {return}
  221.   if {([lindex [split $arg] 0] == "") && ([string match "*#*" $arg])} {putquick "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick joinmodes #channel on/off"; return}
  222.   if {([lindex [split $arg] 1] == "") && ([string match "*#*" $arg])} {putquick "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick joinmodes $chan on/off"; return}
  223.  
  224.   if {([lindex [split $arg] 1] == "on") && ([string match "*#*" $arg])} {
  225.     if {[channel get $chan joinmode]} {putquick "NOTICE $nick :\037ERROR\037: This setting is already enabled."; return}
  226.     channel set $chan +joinmode
  227.     putquick "NOTICE $nick :Enabled Auto @/+ Modes for $chan"
  228.   }
  229.  
  230.   if {([lindex [split $arg] 1] == "off") && ([string match "*#*" $arg])} {
  231.     if {![channel get $chan joinmode]} {putquick "NOTICE $nick :\037ERROR\037: This setting is already disabled."; return}
  232.     channel set $chan -joinmode
  233.     putquick "NOTICE $nick :Disabled Auto @/+ Modes for $chan"
  234.   }
  235. }
  236.  
  237. proc join:modes {nick uhost hand chan} {
  238.   global botnick
  239.   if {[string tolower $nick] != [string tolower $botnick]} {
  240.     if {[channel get $chan joinmode] && [botisop $chan]} {
  241.  
  242.       if {[matchattr [nick2hand $nick] o]} {
  243.         putquick "MODE $chan +v $nick"
  244.         return 0
  245.       }
  246.  
  247.       if {[matchattr [nick2hand $nick] |n $chan]} {
  248.         putquick "MODE $chan +o $nick"
  249.         return 0
  250.       }
  251.  
  252.       if {[matchattr [nick2hand $nick] |m $chan]} {
  253.         putquick "MODE $chan +o $nick"
  254.         return 0
  255.       }
  256.  
  257.       if {[matchattr [nick2hand $nick] |o $chan]} {
  258.         putquick "MODE $chan +o $nick"
  259.         return 0
  260.       }
  261.  
  262.       if {[matchattr [nick2hand $nick] |v $chan]} {
  263.         putquick "MODE $chan +v $nick"
  264.         return 0
  265.       }
  266.     }
  267.   }
  268. }
  269.  
  270. putlog "AddUSER+JoinMODEs: Module LOADED!"
Advertisement
Add Comment
Please, Sign In to add comment