BT.ChanCmds.tcl 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331
  1. #########################################################################
  2. ## BlackTools - The Ultimate Channel Control Script ##
  3. ## One TCL. One smart Eggdrop ##
  4. #########################################################################
  5. ########################## CHAN CMDS TCL ############################
  6. #########################################################################
  7. ## ##
  8. ## BlackTools : http://blacktools.tclscripts.net ##
  9. ## Bugs report : http://www.tclscripts.net/ ##
  10. ## GitHub page : https://github.com/tclscripts/BlackToolS-TCL ##
  11. ## Online Help : irc://irc.undernet.org/tcl-help ##
  12. ## #TCL-HELP / UnderNet ##
  13. ## You can ask in english or romanian ##
  14. ## ##
  15. #########################################################################
  16. proc comand:chan {nick host hand chan arg} {
  17. global botnick wordsdir sdir black seendir count server uptime {server-online} version lastbind
  18. set cmd_chan [lindex [split $arg] 0]
  19. set chan1 $chan
  20. if {[isbotnick $nick]} { return }
  21. set split_cmd [split $cmd_chan ""]
  22. set char [lindex $split_cmd 0]
  23. set cmd [join [lrange $split_cmd 1 end] ""]
  24. set return [blacktools:mychar $char $hand]
  25. if {$return == "0"} {
  26. return
  27. }
  28. switch [string tolower $cmd] {
  29. alias {
  30. if {[matchattr $hand mno|MAO $chan]} {
  31. set chan1 $chan
  32. set type 0
  33. set what [lindex [split $arg] 1]
  34. set cmdf [lindex [split $arg] 2]
  35. set cmd_used [lindex [split $arg] 3]
  36. set text [join [lrange [split $arg] 4 end]]
  37. alias:process $nick $char $hand $chan $chan1 $type [list $what $cmdf $cmd_used $text]
  38. }
  39. }
  40. exempt {
  41. if {[matchattr $hand mno|M $chan]} {
  42. set chan1 $chan
  43. set type 0
  44. set gl 0
  45. set ecmd [lindex [split $arg] 1]
  46. set ehost [lindex [split $arg] 2]
  47. set next [lindex [split $arg] 2]
  48. set tm [lindex [split $arg] 3]
  49. set global [lindex [split $arg] 4]
  50. set reason [join [lrange [split $arg] 5 end]]
  51. set return_time [time_return_minute $tm]
  52. if {$return_time == "-1"} {
  53. set global [lindex [split $arg] 3]
  54. set reason [join [lrange [split $arg] 4 end]]
  55. }
  56. if {[regexp {^[&#]} $ecmd] && [matchattr $hand nmo|MAO $ecmd]} {
  57. set chan $ecmd
  58. set ecmd [lindex [split $arg] 2]
  59. set ehost [lindex [split $arg] 3]
  60. set next [lindex [split $arg] 3]
  61. set tm [lindex [split $arg] 4]
  62. set global [lindex [split $arg] 5]
  63. set reason [join [lrange [split $arg] 6 end]]
  64. set return_time [time_return_minute $tm]
  65. if {$return_time == "-1"} {
  66. set global [lindex [split $arg] 4]
  67. set reason [join [lrange [split $arg] 5 end]]
  68. }
  69. if {[string equal -nocase "$global" "global"] && [matchattr $hand nmo]} {
  70. set gl 1
  71. set tm [lindex [split $arg] 4]
  72. set reason [join [lrange [split $arg] 6 end]]
  73. set return_time [time_return_minute $tm]
  74. if {$return_time == "-1"} {
  75. set reason [join [lrange [split $arg] 5 end]]
  76. }
  77. } else {
  78. if {$return_time == "-1"} {
  79. set reason [join [lrange [split $arg] 4 end]]
  80. } else {
  81. set reason [join [lrange [split $arg] 5 end]]
  82. }
  83. }
  84. } else {
  85. if {[string equal -nocase "$global" "global"] && [matchattr $hand nm]} {
  86. set gl 1
  87. set tm [lindex [split $arg] 3]
  88. set reason [join [lrange [split $arg] 5 end]]
  89. set return_time [time_return_minute $tm]
  90. if {$return_time == "-1"} {
  91. set reason [join [lrange [split $arg] 4 end]]
  92. }
  93. } else {
  94. if {$return_time == "-1"} {
  95. set reason [join [lrange [split $arg] 3 end]]
  96. } else {
  97. set reason [join [lrange [split $arg] 4 end]]
  98. }
  99. }
  100. }
  101. if {![regexp {[0-9]} $tm]} {
  102. set return_time $black(exempt:default_time)
  103. }
  104. exempt:process $nick $char $hand $chan $chan1 $type $ecmd $ehost $return_time $reason $gl $next
  105. }
  106. }
  107. login {
  108. if {[matchattr $hand mn]} {
  109. set chan1 $chan
  110. login:process $nick $host $hand $chan $chan1
  111. }
  112. }
  113. report {
  114. set type 0
  115. set w [lindex [split $arg] 1]
  116. set message [join [lrange [split $arg] 2 end]]
  117. set chan1 $chan
  118. if {[regexp {^[&#]} $w]} {
  119. set chan $w
  120. set w [lindex [split $arg] 2]
  121. set message [join [lrange [split $arg] 3 end]]
  122. }
  123. if {[matchattr $hand mno|MAO $chan]} {
  124. return
  125. }
  126. report:process $nick $char $host $hand $chan $chan1 $type $w $message
  127. }
  128. anunt {
  129. if {[matchattr $hand nmo|M $chan]} {
  130. set type 0
  131. set chan1 "$chan"
  132. set who [lindex [split $arg] 1]
  133. set message [join [lrange [split $arg] 2 end]]
  134. set number [lindex [split $arg] 2]
  135. if {[regexp {^[&#]} $who] && [matchattr $hand nmo|M $who]} {
  136. set chan $who
  137. set who [lindex [split $arg] 2]
  138. set message [join [lrange [split $arg] 3 end]]
  139. set number [lindex [split $arg] 3]
  140. }
  141. anunt:process $nick $char $hand $chan $chan1 $who $message $number $type
  142. }
  143. }
  144. link {
  145. if {[matchattr $hand nm]} {
  146. set type 0
  147. set channels [join [lrange [split $arg] 1 end]]
  148. set what [lindex [split $arg] 1]
  149. set delchan [lindex [split $arg] 2]
  150. set chan1 $chan
  151. link:process $nick $char $hand $chan $chan1 $type $what $channels $delchan
  152. }
  153. }
  154. note {
  155. if {[matchattr $hand nmo|MAOV $chan]} {
  156. set who [lindex [split $arg] 1]
  157. set note [join [lrange [split $arg] 1 end]]
  158. set number [lindex [split $arg] 2]
  159. set user_send [lindex [split $arg] 2]
  160. set note_send [join [lrange [split $arg] 3 end]]
  161. set type 0
  162. set chan1 $chan
  163. note:process $nick $char $hand $chan $chan1 $who $note $user_send $note_send $number $type
  164. }
  165. }
  166. q {
  167. if {($black(quote:usage) == "1" && [matchattr $hand nmo|MAOV $chan]) || $black(quote:usage) == "0"} {
  168. set otherchan 0
  169. set who [lindex [split $arg] 1]
  170. set next [lindex [split $arg] 2]
  171. set quote [join [lrange [split $arg] 1 end]]
  172. if {$who == "*"} {
  173. set who [lindex [split $arg] 2]
  174. set quote [join [lrange [split $arg] 1 end]]
  175. }
  176. if {[regexp {^[\[]} $who]} {
  177. set who [lindex [split $arg] 2]
  178. set quote [join [lrange [split $arg] 1 end]]
  179. if {$who == "*"} {
  180. set who [lindex [split $arg] 3]
  181. set quote [join [lrange [split $arg] 1 end]]
  182. }
  183. }
  184. set type 0
  185. set chan1 $chan
  186. if {[regexp {^[&#]} $who] && [matchattr $hand nmo|AOMV $who]} {
  187. set otherchan 1
  188. set chan "$who"
  189. set who [lindex [split $arg] 2]
  190. set next [lindex [split $arg] 3]
  191. set quote [join [lrange [split $arg] 2 end]]
  192. if {$who == "*"} {
  193. set who [lindex [split $arg] 3]
  194. set quote [join [lrange [split $arg] 2 end]]
  195. }
  196. if {[regexp {^[\[]} $who]} {
  197. set who [lindex [split $arg] 3]
  198. set quote [join [lrange [split $arg] 2 end]]
  199. if {$who == "*"} {
  200. set who [lindex [split $arg] 4]
  201. set quote [join [lrange [split $arg] 2 end]]
  202. }
  203. }
  204. }
  205. if {$otherchan == "1"} {
  206. quote:process $nick "$char:chan" $hand $chan $chan1 $type $who $quote [lrange [split $arg] 2 end] $next
  207. } else {
  208. quote:process $nick "$char:chan" $hand $chan $chan1 $type $who $quote [lrange [split $arg] 1 end] $next
  209. }
  210. }
  211. }
  212. enable {
  213. if {[matchattr $hand nmo|M $chan]} {
  214. set what [lindex [split $arg] 1]
  215. set user [lindex [split $arg] 2]
  216. set chan1 "$chan"
  217. set type 0
  218. if {[regexp {^[&#]} $what] && [matchattr $hand nmo|M $what]} {
  219. set chan "$what"
  220. set what [lindex [split $arg] 2]
  221. set user [lindex [split $arg] 3]
  222. }
  223. enable:process $nick $char $hand $chan $chan1 $type $what $user
  224. }
  225. }
  226. disable {
  227. if {[matchattr $hand nmo|M $chan]} {
  228. set what [lindex [split $arg] 1]
  229. set user [lindex [split $arg] 2]
  230. set chan1 "$chan"
  231. set type 0
  232. if {[regexp {^[&#]} $what] && [matchattr $hand nmo|M $what]} {
  233. set chan "$what"
  234. set what [lindex [split $arg] 2]
  235. set user [lindex [split $arg] 3]
  236. }
  237. disable:process $nick $char $hand $chan $chan1 $type $what $user
  238. }
  239. }
  240. securemode {
  241. if {[matchattr $hand nmo|M $chan]} {
  242. set type 0
  243. set chan1 "$chan"
  244. set why [lindex [split $arg] 1]
  245. set except [join [lrange [split $arg] 2 end]]
  246. set number [lindex [split $arg] 2]
  247. if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
  248. set chan "$why"
  249. set why [lindex [split $arg] 2]
  250. set except [join [lrange [split $arg] 3 end]]
  251. set number [lindex [split $arg] 3]
  252. }
  253. prot:module:process $nick $char $hand $chan $chan1 $why $except $type $number "securemode"
  254. }
  255. }
  256. cp {
  257. if {[matchattr $hand nm]} {
  258. set type 0
  259. set chan1 $chan
  260. set what [lindex [split $arg] 1]
  261. set from [lindex [split $arg] 2]
  262. set to [lindex [split $arg] 3]
  263. cp:process $nick $char $hand $chan $chan1 $type $what $from $to
  264. }
  265. }
  266. troll {
  267. if {[matchattr $hand nmo|AOM $chan]} {
  268. set tr [lindex [split $arg] 1]
  269. set chan1 "$chan"
  270. set type 0
  271. if {[regexp {^[&#]} $tr] && [matchattr $hand nmo|MAO $tr]} {
  272. set chan "$tr"
  273. set tr [lindex [split $arg] 2]
  274. }
  275. userhost:act $tr $nick $hand $char $chan $chan1 $type "1440" "troll" "" "0"
  276. }
  277. }
  278. badhost {
  279. if {[matchattr $hand nmo|M $chan]} {
  280. set type 0
  281. set chan1 "$chan"
  282. set why [lindex [split $arg] 1]
  283. set badh [join [lrange [split $arg] 2 end]]
  284. set number [lindex [split $arg] 2]
  285. if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
  286. set chan "$why"
  287. set why [lindex [split $arg] 2]
  288. set badh [join [lrange [split $arg] 3 end]]
  289. set number [lindex [split $arg] 3]
  290. }
  291. prot:module:process $nick $char $hand $chan $chan1 $why $badh $type $number "badhost"
  292. }
  293. }
  294. antispam {
  295. if {[matchattr $hand nmo|M $chan]} {
  296. set type 0
  297. set chan1 "$chan"
  298. set why [lindex [split $arg] 1]
  299. set antisp [join [lrange [split $arg] 2 end]]
  300. set number [lindex [split $arg] 2]
  301. if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
  302. set chan "$why"
  303. set why [lindex [split $arg] 2]
  304. set antisp [join [lrange [split $arg] 3 end]]
  305. set number [lindex [split $arg] 3]
  306. }
  307. prot:module:process $nick $char $hand $chan $chan1 $why $antisp $type $number "antispam"
  308. }
  309. }
  310. badrealname {
  311. if {[matchattr $hand nmo|M $chan]} {
  312. set type 0
  313. set chan1 "$chan"
  314. set why [lindex [split $arg] 1]
  315. set badf [join [lrange [split $arg] 2 end]]
  316. set number [lindex [split $arg] 2]
  317. if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
  318. set chan "$why"
  319. set why [lindex [split $arg] 2]
  320. set badf [join [lrange [split $arg] 3 end]]
  321. set number [lindex [split $arg] 3]
  322. }
  323. prot:module:process $nick $char $hand $chan $chan1 $why $badf $type $number "badrealname"
  324. }
  325. }
  326. badquitpart {
  327. if {[matchattr $hand nmo|M $chan]} {
  328. set type 0
  329. set chan1 "$chan"
  330. set why [lindex [split $arg] 1]
  331. set badq [join [lrange [split $arg] 2 end]]
  332. set number [lindex [split $arg] 2]
  333. if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
  334. set chan "$why"
  335. set why [lindex [split $arg] 2]
  336. set badq [join [lrange [split $arg] 3 end]]
  337. set number [lindex [split $arg] 3]
  338. }
  339. prot:module:process $nick $char $hand $chan $chan1 $why $badq $type $number "badquitpart"
  340. }
  341. }
  342. badident {
  343. if {[matchattr $hand nmo|M $chan]} {
  344. set type 0
  345. set chan1 "$chan"
  346. set why [lindex [split $arg] 1]
  347. set badi [join [lrange [split $arg] 2 end]]
  348. set number [lindex [split $arg] 2]
  349. if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
  350. set chan "$why"
  351. set why [lindex [split $arg] 2]
  352. set badi [join [lrange [split $arg] 3 end]]
  353. set number [lindex [split $arg] 3]
  354. }
  355. prot:module:process $nick $char $hand $chan $chan1 $why $badi $type $number "badident"
  356. }
  357. }
  358. badnick {
  359. if {[matchattr $hand nmo|M $chan]} {
  360. set type 0
  361. set chan1 "$chan"
  362. set why [lindex [split $arg] 1]
  363. set badn [join [lrange [split $arg] 2 end]]
  364. set number [lindex [split $arg] 2]
  365. if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
  366. set chan "$why"
  367. set why [lindex [split $arg] 2]
  368. set badn [join [lrange [split $arg] 3 end]]
  369. set number [lindex [split $arg] 3]
  370. }
  371. prot:module:process $nick $char $hand $chan $chan1 $why $badn $type $number "badnick"
  372. }
  373. }
  374. badword {
  375. if {[matchattr $hand nmo|M $chan]} {
  376. set type 0
  377. set chan1 "$chan"
  378. set why [lindex [split $arg] 1]
  379. set badw [join [lrange [split $arg] 2 end]]
  380. set number [lindex [split $arg] 2]
  381. if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
  382. set chan "$why"
  383. set why [lindex [split $arg] 2]
  384. set badw [join [lrange [split $arg] 3 end]]
  385. set number [lindex [split $arg] 3]
  386. }
  387. prot:module:process $nick $char $hand $chan $chan1 $why $badw $type $number "badword"
  388. }
  389. }
  390. unset {
  391. if {[matchattr $hand nmo|M $chan]} {
  392. set setting [lindex [split $arg] 1]
  393. set chan1 $chan
  394. set type 0
  395. if {[regexp {^[&#]} $setting] && [matchattr $hand nmo|M $setting]} {
  396. set chan $setting
  397. set setting [lindex [split $arg] 2]
  398. }
  399. if {[string equal -nocase $setting "global"] && [matchattr $hand nm]} {
  400. set setting [lindex [split $arg] 2]
  401. foreach c [channels] {
  402. unset:process $nick $char $hand $c $chan1 $setting $type
  403. }
  404. return
  405. }
  406. foreach c [channels] {
  407. set backchan [join [setting:get $c backchan]]
  408. if {[string match -nocase $chan $backchan]} {
  409. set chan "$c"
  410. }
  411. }
  412. unset:process $nick $char $hand $chan $chan1 $setting $type
  413. }
  414. }
  415. greet {
  416. if {[matchattr $hand nmo|M $chan]} {
  417. set who [lindex [split $arg] 1]
  418. set modul "greet"
  419. set type 0
  420. set chan1 $chan
  421. set greet [join [lrange [split $arg] 2 end]]
  422. if {[regexp {^[&#]} $who] && [matchattr $hand nmo|M $who]} {
  423. set chan $who
  424. set who [lindex [split $arg] 2]
  425. set greet [join [lrange [split $arg] 3 end]]
  426. }
  427. othermodule:process $nick $char $hand $chan $chan1 $who $greet $type $modul
  428. }
  429. }
  430. leave {
  431. if {[matchattr $hand nmo|M $chan]} {
  432. set who [lindex [split $arg] 1]
  433. set modul "leave"
  434. set type 0
  435. set chan1 $chan
  436. set leave [join [lrange [split $arg] 2 end]]
  437. if {[regexp {^[&#]} $who] && [matchattr $hand nmo|M $who]} {
  438. set chan $who
  439. set who [lindex [split $arg] 2]
  440. set leave [join [lrange [split $arg] 3 end]]
  441. }
  442. othermodule:process $nick $char $hand $chan $chan1 $who $leave $type $modul
  443. }
  444. }
  445. topic {
  446. if {[matchattr $hand nmo|M $chan]} {
  447. set who [lindex [split $arg] 1]
  448. set modul "topic"
  449. set type 0
  450. set chan1 $chan
  451. set topic [join [lrange [split $arg] 2 end]]
  452. if {[regexp {^[&#]} $who] && [matchattr $hand nmo|M $who]} {
  453. set chan $who
  454. set who [lindex [split $arg] 2]
  455. set topic [join [lrange [split $arg] 3 end]]
  456. }
  457. othermodule:process $nick $char $hand $chan $chan1 $who $topic $type $modul
  458. }
  459. }
  460. vr {
  461. if {[matchattr $hand nmo|OMA $chan]} {
  462. set vr [lindex [split $arg] 1]
  463. set com [join [lrange [split $arg] 2 end]]
  464. set chan1 "$chan"
  465. set type 0
  466. if {[regexp {^[&#]} $vr] && [matchattr $hand nmo|MAO $vr]} {
  467. set chan "$vr"
  468. set vr [lindex [split $arg] 2]
  469. set com [join [lrange [split $arg] 3 end]]
  470. }
  471. foreach c [channels] {
  472. set backchan [join [setting:get $c backchan]]
  473. if {[string match -nocase $chan $backchan]} {
  474. set chan "$c"
  475. }
  476. }
  477. userhost:act $vr $nick $hand $char $chan $chan1 $type $black(vr:bantime) "vr" "$com" "0"
  478. }
  479. }
  480. dr {
  481. if {[matchattr $hand nmo|OMA $chan]} {
  482. set drone [lindex [split $arg] 1]
  483. set com [join [lrange [split $arg] 2 end]]
  484. set type 0
  485. set chan1 "$chan"
  486. if {[regexp {^[&#]} $drone] && [matchattr $hand nmo|OMA $drone]} {
  487. set chan "$drone"
  488. set drone [lindex [split $arg] 2]
  489. set com [join [lrange [split $arg] 3 end]]
  490. }
  491. foreach c [channels] {
  492. set backchan [join [setting:get $c backchan]]
  493. if {[string match -nocase $chan $backchan]} {
  494. set chan "$c"
  495. }
  496. }
  497. userhost:act $drone $nick $hand $char $chan $chan1 $type $black(dr:bantime) "dr" "$com" "0"
  498. }
  499. }
  500. bot {
  501. if {[matchattr $hand nmo|OMA $chan]} {
  502. set bot [lindex [split $arg] 1]
  503. set com [join [lrange [split $arg] 2 end]]
  504. set type 0
  505. set chan1 "$chan"
  506. if {[regexp {^[&#]} $bot] && [matchattr $hand nmo|OMA $bot]} {
  507. set chan "$bot"
  508. set bot [lindex [split $arg] 2]
  509. set com [join [lrange [split $arg] 3 end]]
  510. }
  511. foreach c [channels] {
  512. set backchan [join [setting:get $c backchan]]
  513. if {[string match -nocase $chan $backchan]} {
  514. set chan "$c"
  515. }
  516. }
  517. userhost:act $bot $nick "$hand:bot" $char $chan $chan1 $type $black(bot:bantime) "bot" "$com" "0"
  518. }
  519. }
  520. n {
  521. if {[matchattr $hand nmo|OMA $chan]} {
  522. set badnick [lindex [split $arg] 1]
  523. set com [join [lrange [split $arg] 2 end]]
  524. set type 0
  525. set chan1 "$chan"
  526. if {[regexp {^[&#]} $badnick] && [matchattr $hand nmo|MAO $badnick]} {
  527. set chan "$badnick"
  528. set badnick [lindex [split $arg] 2]
  529. set com [join [lrange [split $arg] 3 end]]
  530. }
  531. if {[setting:get $chan nextshortcmd]} {
  532. nextpublic:process $nick $char $hand $chan $chan1 $badnick
  533. return
  534. }
  535. if {[regexp {\*} $badnick]} {
  536. blacktools:tell $nick $char $hand $chan $chan1 gl.instr "n"
  537. return
  538. }
  539. if {$badnick == ""} {
  540. blacktools:tell $nick $char $hand $chan $chan1 gl.instr "n"
  541. return
  542. }
  543. foreach c [channels] {
  544. set backchan [join [setting:get $c backchan]]
  545. if {[string match -nocase $chan $backchan]} {
  546. set chan "$c"
  547. }
  548. }
  549. bancmds:process $badnick $badnick $nick $hand $char $chan $chan1 $type $black(n:bantime) "n" "$com" "0"
  550. }
  551. }
  552. id {
  553. if {[matchattr $hand nmo|OMA $chan]} {
  554. set badident [lindex [split $arg] 1]
  555. set com [join [lrange [split $arg] 2 end]]
  556. set handle [nick2hand $badident]
  557. set type 0
  558. set chan1 "$chan"
  559. if {[regexp {^[&#]} $badident] && [matchattr $hand nmo|OMA $badident]} {
  560. set chan "$badident"
  561. set badident [lindex [split $arg] 2]
  562. set com [join [lrange [split $arg] 3 end]]
  563. }
  564. foreach c [channels] {
  565. set backchan [join [setting:get $c backchan]]
  566. if {[string match -nocase $chan $backchan]} {
  567. set chan "$c"
  568. }
  569. }
  570. userhost:act $badident $nick $hand $char $chan $chan1 $type $black(id:bantime) "id" "$com" "0"
  571. }
  572. }
  573. spam {
  574. if {[matchattr $hand nmo|OMA $chan]} {
  575. set spammer [lindex [split $arg] 1]
  576. set com [join [lrange [split $arg] 2 end]]
  577. set type 0
  578. set chan1 "$chan"
  579. if {[regexp {^[&#]} $spammer] && [matchattr $hand nmo|OMA $spammer]} {
  580. set chan "$spammer"
  581. set spammer [lindex [split $arg] 2]
  582. set com [join [lrange [split $arg] 3 end]]
  583. }
  584. foreach c [channels] {
  585. set backchan [join [setting:get $c backchan]]
  586. if {[string match -nocase $chan $backchan]} {
  587. set chan "$c"
  588. }
  589. }
  590. userhost:act $spammer $nick $hand $char $chan $chan1 $type $black(spam:bantime) "spam" "$com" "0"
  591. }
  592. }
  593. bw {
  594. if {[matchattr $hand nmo|OMA $chan]} {
  595. set badw [lindex [split $arg] 1]
  596. set com [join [lrange [split $arg] 2 end]]
  597. set type 0
  598. set chan1 "$chan"
  599. if {[regexp {^[&#]} $badw] && [matchattr $hand nmo|OMA $badw]} {
  600. set chan "$badw"
  601. set badw [lindex [split $arg] 2]
  602. set com [join [lrange [split $arg] 3 end]]
  603. }
  604. foreach c [channels] {
  605. set backchan [join [setting:get $c backchan]]
  606. if {[string match -nocase $chan $backchan]} {
  607. set chan "$c"
  608. }
  609. }
  610. userhost:act $badw $nick $hand $char $chan $chan1 $type $black(bw:bantime) "bw" "$com" "0"
  611. }
  612. }
  613. mb {
  614. if {[matchattr $hand nmo|OMA $chan]} {
  615. set badd [lindex [split $arg] 1]
  616. set reason [join [lrange [split $arg] 2 end]]
  617. set type 0
  618. set chan1 "$chan"
  619. if {[regexp {^[&#]} $badd] && [matchattr $hand nmo|OMA $badw]} {
  620. set chan "$badd"
  621. set badd [lindex [split $arg] 2]
  622. set reason [join [lrange [split $arg] 3 end]]
  623. }
  624. foreach c [channels] {
  625. set backchan [join [setting:get $c backchan]]
  626. if {[string match -nocase $chan $backchan]} {
  627. set chan "$c"
  628. }
  629. }
  630. userhost:act $badd $nick $hand $char $chan $chan1 $type $black(mb:bantime) "mb" $reason "0"
  631. }
  632. }
  633. black {
  634. if {[matchattr $hand nmo|MA $chan]} {
  635. set blackb [lindex [split $arg] 1]
  636. set reason [join [lrange [split $arg] 2 end]]
  637. set type 0
  638. set chan1 "$chan"
  639. if {[regexp {^[&#]} $blackb] && [matchattr $hand nmo|MA $blackb]} {
  640. set chan "$blackb"
  641. set blackb [lindex [split $arg] 2]
  642. set reason [join [lrange [split $arg] 3 end]]
  643. }
  644. foreach c [channels] {
  645. set backchan [join [setting:get $c backchan]]
  646. if {[string match -nocase $chan $backchan]} {
  647. set chan "$c"
  648. }
  649. }
  650. userhost:act $blackb $nick $hand $char $chan $chan1 $type "0" "black" $reason "0"
  651. }
  652. }
  653. bl {
  654. if {[matchattr $hand nmo|MA $chan]} {
  655. set blackb [lindex [split $arg] 1]
  656. set reason [join [lrange [split $arg] 2 end]]
  657. set type 0
  658. set chan1 "$chan"
  659. if {[regexp {^[&#]} $blackb] && [matchattr $hand nmo|MA $blackb]} {
  660. set chan "$blackb"
  661. set blackb [lindex [split $arg] 2]
  662. set reason [join [lrange [split $arg] 3 end]]
  663. }
  664. foreach c [channels] {
  665. set backchan [join [setting:get $c backchan]]
  666. if {[string match -nocase $chan $backchan]} {
  667. set chan "$c"
  668. }
  669. }
  670. userhost:act $blackb $nick $hand $char $chan $chan1 $type "0" "black" $reason "0"
  671. }
  672. }
  673. b {
  674. if {[matchattr $hand nmo|OMA $chan]} {
  675. set no_time 0
  676. set type 0
  677. set gl 0
  678. set link 0
  679. set chan1 "$chan"
  680. set level ""
  681. set regex 0
  682. set b [lindex [split $arg] 1]
  683. if {[string equal -nocase $b "-regex"]} {
  684. set regex 1
  685. set b [lindex [split $arg] [expr 1 + $regex]]
  686. }
  687. if {[setting:get $chan nextshortcmd]} {
  688. noidlepublic:process $nick $char $hand $chan $chan1 $b 0
  689. return
  690. }
  691. set tm [lindex [split $arg] [expr 2 + $regex]]
  692. set global [lindex [split $arg] [expr 3 + $regex]]
  693. set reason [join [lrange [split $arg] [expr 4 + $regex] end]]
  694. set return_time [time_return_minute $tm]
  695. if {$return_time == "-1"} {
  696. set global [lindex [split $arg] [expr 2 + $regex]]
  697. set reason [join [lrange [split $arg] [expr 3 + $regex] end]]
  698. }
  699. if {[regexp {^[&#]} $b] && [matchattr $hand nmo|MAO $b]} {
  700. set chan $b
  701. set b [lindex [split $arg] 2]
  702. if {[string equal -nocase $b "-regex"]} {
  703. set regex 1
  704. set b [lindex [split $arg] [expr 2 + $regex]]
  705. }
  706. set tm [lindex [split $arg] [expr 3 + $regex]]
  707. set global [lindex [split $arg] [expr 4 + $regex]]
  708. set reason [join [lrange [split $arg] [expr 5 + $regex] end]]
  709. set return_time [time_return_minute $tm]
  710. if {$return_time == "-1"} {
  711. set global [lindex [split $arg] [expr 3 + $regex]]
  712. set reason [join [lrange [split $arg] [expr 4 + $regex] end]]
  713. }
  714. if {[regexp {^[-]} $tm]} {
  715. set level [blacktools:check:levelban $hand $chan $tm]
  716. set reason [join [lrange [split $arg] [expr 5 + $regex] end]]
  717. set tm [lindex [split $arg] [expr 4 + $regex]]
  718. set return_time [time_return_minute $tm]
  719. if {$return_time == "-1"} {
  720. set tm [lindex [split $arg] [expr 3 + $regex]]
  721. set reason [join [lrange [split $arg] [expr 4 + $regex] end]]
  722. }
  723. } elseif {[string equal -nocase "$global" "global"] && [matchattr $hand nm]} {
  724. set gl 1
  725. set tm [lindex [split $arg] [expr 3 + $regex]]
  726. set reason [join [lrange [split $arg] [expr 5 + $regex] end]]
  727. set return_time [time_return_minute $tm]
  728. if {$return_time == "-1"} {
  729. set reason [join [lrange [split $arg] [expr 4 + $regex] end]]
  730. }
  731. } else {
  732. if {$return_time == "-1"} {
  733. set reason [join [lrange [split $arg] [expr 3 + $regex] end]]
  734. } else {
  735. set reason [join [lrange [split $arg] [expr 4 + $regex] end]]
  736. }
  737. }
  738. } else {
  739. if {[regexp {^[-]} $tm]} {
  740. set levelban 1
  741. set level [blacktools:check:levelban $hand $chan $tm]
  742. set reason [join [lrange [split $arg] [expr 4 + $regex] end]]
  743. set tm [lindex [split $arg] [expr 3 + $regex]]
  744. set return_time [time_return_minute $tm]
  745. if {$return_time == "-1"} {
  746. set tm [lindex [split $arg] [expr 2 + $regex]]
  747. set reason [join [lrange [split $arg] [expr 3 + $regex] end]]
  748. }
  749. } elseif {[string equal -nocase "$global" "global"] && [matchattr $hand nm]} {
  750. set gl 1
  751. set tm [lindex [split $arg] [expr 2 + $regex]]
  752. set reason [join [lrange [split $arg] [expr 4 + $regex] end]]
  753. set return_time [time_return_minute $tm]
  754. if {$return_time == "-1"} {
  755. set reason [join [lrange [split $arg] [expr 3 + $regex] end]]
  756. }
  757. } elseif {[string equal -nocase "$global" "link"] && [matchattr $hand nm]} {
  758. set link 1
  759. set tm [lindex [split $arg] [expr 2 + $regex]]
  760. set reason [join [lrange [split $arg] [expr 4 + $regex] end]]
  761. set return_time [time_return_minute $tm]
  762. if {$return_time == "-1"} {
  763. set reason [join [lrange [split $arg] [expr 3 + $regex] end]]
  764. }
  765. } else {
  766. if {$return_time == "-1"} {
  767. set reason [join [lrange [split $arg] [expr 2 + $regex] end]]
  768. } else {
  769. set reason [join [lrange [split $arg] [expr 3 + $regex] end]]
  770. }
  771. }
  772. }
  773. if {($return_time > "20160" || $return_time == "0") && [matchattr $hand -|O $chan]} {
  774. blacktools:tell $nick $char $hand $chan $chan1 b.6 none
  775. return
  776. }
  777. if {$return_time == "-1"} {
  778. set return_time $black(b:bantime)
  779. }
  780. if {[llength $level] > "1"} {
  781. blacktools:tell $nick $char $hand $chan $chan1 gl.invalidlevel [string map {"0" ""} $level]
  782. return
  783. }
  784. foreach c [channels] {
  785. set backchan [join [setting:get $c backchan]]
  786. if {[string match -nocase $chan $backchan]} {
  787. set chan "$c"
  788. }
  789. }
  790. if {$regex == 1} {
  791. set check_regex [catch {regexp $b ""}]
  792. if {$check_regex == 1} {
  793. blacktools:tell $nick $char $hand $chan $chan1 b.11 "$b"
  794. return
  795. }
  796. }
  797. if {$regex == 1} {
  798. set cmd [list "b" "REGEX"]
  799. } else {
  800. set cmd "b"
  801. }
  802. if {$level != ""} {
  803. userhost:act $b $nick "$hand:$level" $char $chan $chan1 $type $return_time $cmd $reason $gl
  804. } else {
  805. if {$link == "1"} {
  806. userhost:act $b $nick $hand $char $chan $chan1 $type $return_time $cmd $reason "2"
  807. utimer 5 [list blacktools:link_ban [link:chan:get $chan] 0 $b $nick $hand $char $chan $chan1 $type $return_time $cmd $reason 2]
  808. return
  809. }
  810. userhost:act $b $nick $hand $char $chan $chan1 $type $return_time $cmd $reason $gl
  811. }
  812. }
  813. }
  814. stick {
  815. if {[matchattr $hand nmo|M $chan]} {
  816. set stickb [lindex [split $arg] 1]
  817. set tm [lindex [split $arg] 2]
  818. set return_time [time_return_minute $tm]
  819. if {$return_time == "-1"} {
  820. set reason [join [lrange [split $arg] 2 end]]
  821. } else {
  822. set tm [lindex [split $arg] 3]
  823. set reason [join [lrange [split $arg] 3 end]]
  824. }
  825. set type 0
  826. set chan1 "$chan"
  827. if {[regexp {^[&#]} $stickb] && [matchattr $hand nmo|MA $stickb]} {
  828. set chan "$stickb"
  829. set stickb [lindex [split $arg] 2]
  830. set tm [lindex [split $arg] 3]
  831. set return_time [time_return_minute $tm]
  832. if {$return_time == "-1"} {
  833. set reason [join [lrange [split $arg] 3 end]]
  834. } else {
  835. set tm [lindex [split $arg] 4]
  836. set reason [join [lrange [split $arg] 4 end]]
  837. }
  838. }
  839. if {($return_time > "20160" || $return_time == "0") && [matchattr $hand -|OS $stickb]} {
  840. blacktools:tell $nick $char $hand $chan $chan1 b.6 none
  841. return
  842. }
  843. if {$return_time == "-1"} {
  844. set return_time $black(stick:bantime)
  845. }
  846. foreach c [channels] {
  847. set backchan [join [setting:get $c backchan]]
  848. if {[string match -nocase $chan $backchan]} {
  849. set chan "$c"
  850. }
  851. }
  852. userhost:act $stickb $nick $hand $char $chan $chan1 $type $return_time "stick" $reason "0"
  853. }
  854. }
  855. ub {
  856. if {[matchattr $hand nmo|MAO $chan]} {
  857. set ban [lindex [split $arg] 1]
  858. set regexp 0
  859. if {[string equal -nocase $ban "-regex"]} {
  860. set regexp 1
  861. }
  862. set ban [lindex [split $arg] [expr $regexp + 1]]
  863. set why [lindex [split $arg] [expr $regexp + 2]]
  864. set type 0
  865. set chan1 "$chan"
  866. if {[regexp {^[&#]} $ban] && [matchattr $hand nmo|MAO $ban]} {
  867. set chan "$ban"
  868. set ban [lindex [split $arg] 2]
  869. if {[string equal -nocase $ban "-regex"]} {
  870. set regexp 1
  871. }
  872. set ban [lindex [split $arg] [expr $regexp + 2]]
  873. set why [lindex [split $arg] [expr $regexp + 3]]
  874. }
  875. if {[regexp {^[0-9]} $ban]} {
  876. set cmd "ub:id"
  877. } else {
  878. set cmd "ub"
  879. }
  880. if {$regexp == "1"} {
  881. set cmd [list $cmd "REGEX"]
  882. }
  883. foreach c [channels] {
  884. set backchan [join [setting:get $c backchan]]
  885. if {[string match -nocase $chan $backchan]} {
  886. set chan "$c"
  887. }
  888. }
  889. if {[string equal -nocase $why "global"] && [matchattr $hand nm]} {
  890. ub:process $ban $ban $nick $hand $char $chan $chan1 $type "1" $cmd "" "" ""
  891. } elseif {[string equal -nocase $why "link"] && [matchattr $hand nm]} {
  892. ub:process $ban $ban $nick $hand $char $chan $chan1 $type "" $cmd "" "1" ""
  893. } else {
  894. ub:process $ban $ban $nick $hand $char $chan $chan1 $type "" $cmd "" "" ""
  895. }
  896. }
  897. }
  898. sb {
  899. if {[matchattr $hand nmo|VMAO $chan]} {
  900. set regexp 0
  901. set bhost [lindex [split $arg] 1]
  902. if {[string equal -nocase $bhost "-regex"]} {
  903. set regexp 1
  904. }
  905. set bhost [lindex [split $arg] [expr $regexp + 1]]
  906. set what [lindex [split $arg] [expr $regexp + 2]]
  907. set type 0
  908. set chan1 "$chan"
  909. if {[regexp {^[&#]} $bhost] && [matchattr $hand nmo|MAO $bhost]} {
  910. set chan "$bhost"
  911. set bhost [lindex [split $arg] 2]
  912. if {[string equal -nocase $bhost "-regex"]} {
  913. set regex 1
  914. }
  915. set bhost [lindex [split $arg] [expr $regexp + 2]]
  916. set what [lindex [split $arg] [expr $regexp + 3]]
  917. }
  918. foreach c [channels] {
  919. set backchan [join [setting:get $c backchan]]
  920. if {[string match -nocase $chan $backchan]} {
  921. set chan "$c"
  922. }
  923. }
  924. if {$bhost != ""} {
  925. if {[regexp {^[0-9]} $bhost]} {
  926. sb:process $bhost $what $nick $hand $char $chan $chan1 $type "sb" "2"
  927. return
  928. }
  929. if {![validchan $chan]} {
  930. blacktools:tell $nick $char $hand $chan $chan1 gl.novalidchan none
  931. return
  932. }
  933. if {[onchan $bhost $chan]} {
  934. set bhost "$bhost![getchanhost $bhost $chan]"
  935. sb:process $bhost $what $nick $hand $char $chan $chan1 $type "sb" "1"
  936. return
  937. }
  938. if {$regexp == 1} {
  939. sb:process $bhost $what $nick $hand $char $chan $chan1 $type [list "sb" "REGEX"] "1"
  940. return
  941. } elseif {[regexp {\*} $bhost]} {
  942. sb:process $bhost $what $nick $hand $char $chan $chan1 $type "sb" "1"
  943. return
  944. }
  945. sb:process $bhost $what $nick $hand $char $chan $chan1 $type "sb" ""
  946. } else { sb:process $bhost $what $nick $hand $char $chan $chan1 $type "sb" ""}
  947. }
  948. }
  949. banlist {
  950. if {[matchattr $hand nmo|AOM $chan]} {
  951. set user [lindex [split $arg] 1]
  952. set next [lindex [split $arg] 2]
  953. set type 0
  954. set chan1 "$chan"
  955. if {[regexp {^[&#]} $user] && [matchattr $hand nmo|MASO $user]} {
  956. set chan "$user"
  957. set user [lindex [split $arg] 2]
  958. set next [lindex [split $arg] 3]
  959. }
  960. foreach c [channels] {
  961. set backchan [join [setting:get $c backchan]]
  962. if {[string match -nocase $chan $backchan]} {
  963. set chan "$c"
  964. }
  965. }
  966. banlist:process $nick $char $hand $chan $chan1 $user $type "banlist" $next
  967. }
  968. }
  969. r {
  970. if {[matchattr $hand nmo|MAO $chan]} {
  971. set c [lindex [split $arg] 1]
  972. set chan1 $chan
  973. if {$c != "" && [matchattr $hand nmo|AMO $c]} {
  974. topic:refresh $nick $char $hand $c $chan1 $arg
  975. return
  976. }
  977. topic:refresh $nick $char $hand $chan $chan1 $arg
  978. }
  979. }
  980. man {
  981. if {[matchattr $hand nmo|MAOV $chan]} {
  982. set command [lindex [split $arg] 1]
  983. set type 0
  984. set chan1 $chan
  985. man:process $nick $char $hand $chan $chan1 $type $command
  986. }
  987. }
  988. auto {
  989. if {[matchattr $hand nmo|MA $chan]} {
  990. set type 0
  991. set chan1 "$chan"
  992. set option [lindex [split $arg] 1]
  993. set user [lindex [split $arg] 2]
  994. set global [lindex [split $arg] 3]
  995. if {[regexp {^[&#]} $option] && [matchattr $hand nmo|MA $option] && ![string equal -nocase $global "global"]} {
  996. set chan "$option"
  997. set option [lindex [split $arg] 2]
  998. set user [lindex [split $arg] 3]
  999. set global [lindex [split $arg] 4]
  1000. }
  1001. auto:process $nick $char $hand $chan $chan1 $user $option $global $type
  1002. }
  1003. }
  1004. antipub {
  1005. if {[matchattr $hand nmo|M $chan]} {
  1006. set type 0
  1007. set chan1 "$chan"
  1008. set why [lindex [split $arg] 1]
  1009. set except [join [lrange [split $arg] 2 end]]
  1010. set number [lindex [split $arg] 2]
  1011. if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
  1012. set chan "$why"
  1013. set why [lindex [split $arg] 2]
  1014. set except [join [lrange [split $arg] 3 end]]
  1015. set number [lindex [split $arg] 3]
  1016. }
  1017. prot:module:process $nick $char $hand $chan $chan1 $why $except $type $number "antipub"
  1018. }
  1019. }
  1020. private {
  1021. if {[matchattr $hand nmo|M $chan]} {
  1022. set type 0
  1023. set chan1 "$chan"
  1024. set why [lindex [split $arg] 1]
  1025. set user [lindex [split $arg] 2]
  1026. if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $chan]} {
  1027. set chan "$why"
  1028. set why [lindex [split $arg] 2]
  1029. set user [lindex [split $arg] 3]
  1030. }
  1031. private:process $nick $char $hand $chan $chan1 $why $user $type
  1032. }
  1033. }
  1034. tcl {
  1035. if {[matchattr $hand n]} {
  1036. set type 0
  1037. set chan1 "$chan"
  1038. set the_script [lindex [split $arg] 2]
  1039. set who [lindex [split $arg] 1]
  1040. tcl:process $nick $char $hand $chan $chan1 $type $the_script $who
  1041. }
  1042. }
  1043. h {
  1044. if {[matchattr $hand nmo|MSOAV $chan]} {
  1045. set chan1 "$chan"
  1046. set type 0
  1047. set command [lindex [split $arg] 1]
  1048. if {[setting:get $chan nextshortcmd]} {
  1049. helpedpublic:process $nick $char $hand $chan $chan1 $command 0
  1050. return
  1051. }
  1052. h:process $nick $char $hand $chan $chan1 $command $type
  1053. }
  1054. }
  1055. ignore {
  1056. if {[matchattr $hand nmo|M $chan]} {
  1057. set chan1 "$chan"
  1058. set type 0
  1059. set what [lindex [split $arg] 1]
  1060. set mask [lindex [split $arg] 2]
  1061. set time [lindex [split $arg] 3]
  1062. set reason [join [lrange [split $arg] 4 end]]
  1063. if {![regexp {^[0-9]} $time]} {
  1064. set reason [join [lrange [split $arg] 3 end]]
  1065. }
  1066. ignore:process $nick $char $hand $chan $chan1 $what $mask $time $reason $type
  1067. }
  1068. }
  1069. idle {
  1070. if {[matchattr $hand nmo|M $chan]} {
  1071. set type 0
  1072. set chan1 "$chan"
  1073. set why [lindex [split $arg] 1]
  1074. set user [lindex [split $arg] 2]
  1075. set host [lindex [split $arg] 3]
  1076. if {[regexp {^[&#]} $why] && [matchattr $hand nmo|- $why]} {
  1077. set chan "$why"
  1078. set why [lindex [split $arg] 2]
  1079. set user [lindex [split $arg] 3]
  1080. set host [lindex [split $arg] 4]
  1081. }
  1082. antidle:process $why $type $user $char $nick $hand $chan $chan1
  1083. }
  1084. }
  1085. version {
  1086. if {[matchattr $hand nmo|MASOV $chan]} {
  1087. set cmd_status [btcmd:status $chan $hand "version" 0]
  1088. set text [lindex [split $arg] 1]
  1089. if {$cmd_status == "1"} {
  1090. return
  1091. }
  1092. set chan1 "$chan"
  1093. version:process $nick $char $hand $chan $chan1 $text
  1094. }
  1095. }
  1096. stats {
  1097. if {[matchattr $hand nmo|MA $chan]} {
  1098. set type 0
  1099. set chan1 "$chan"
  1100. set user [lindex [split $arg] 1]
  1101. set option [lindex [split $arg] 2]
  1102. if {[regexp {^[&#]} $user] && [matchattr $hand nmo|MAOV $user]} {
  1103. set chan "$user"
  1104. set user [lindex [split $arg] 2]
  1105. set option [lindex [split $arg] 3]
  1106. }
  1107. stats:process $nick $char $hand $chan $chan1 $user $option $type
  1108. }
  1109. }
  1110. chat {
  1111. if {[matchattr $hand nm]} {
  1112. set cmd_status [btcmd:status $chan $hand "chat" 0]
  1113. if {$cmd_status == "1"} {
  1114. return
  1115. }
  1116. if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
  1117. return
  1118. }
  1119. set chan1 $chan
  1120. *ctcp:CHAT $nick $char $hand $botnick CHAT $arg
  1121. blacktools:tell $nick $char $hand $chan $chan1 chat.1 none
  1122. }
  1123. }
  1124. seen {
  1125. set type 0
  1126. set wseen [lindex [split $arg] 1]
  1127. set chan1 "$chan"
  1128. if {[regexp {^[&#]} $wseen] && [matchattr $hand nmo|MAOV $wseen]} {
  1129. set chan1 "$chan"
  1130. set chan $wseen
  1131. set wseen [lindex [split $arg] 2]
  1132. seen:process $nick "$char:$host" $hand $chan $chan1 $wseen $type 0
  1133. } elseif {[string equal -nocase $wseen "global"] && [matchattr $hand nmo]} {
  1134. set wseen [lindex [split $arg] 2]
  1135. seen:process $nick "$char:$host" $hand $chan $chan1 $wseen $type 1
  1136. } else {
  1137. seen:process $nick "$char:$host" $hand $chan $chan1 $wseen $type 0
  1138. }
  1139. }
  1140. limit {
  1141. if {[matchattr $hand nmo|M $chan]} {
  1142. set why [lindex [split $arg] 1]
  1143. set lm [lindex [split $arg] 2]
  1144. set type 0
  1145. set chan1 "$chan"
  1146. if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
  1147. set chan "$why"
  1148. set why [lindex [split $arg] 2]
  1149. set lm [lindex [split $arg] 3]
  1150. }
  1151. limit:process $nick $char $hand $chan $chan1 $why $lm $type
  1152. }
  1153. }
  1154. bt {
  1155. if {[matchattr $hand nm]} {
  1156. set chan1 "$chan"
  1157. set type 0
  1158. set who [lindex [split $arg] 1]
  1159. set message [join [lrange [split $arg] 2 end]]
  1160. set number [lindex [split $arg] 2]
  1161. broadcast:process $nick $char $hand $chan $chan1 $who $message $number $type
  1162. }
  1163. }
  1164. badchan {
  1165. if {[matchattr $hand nmo|M $chan]} {
  1166. set why [lindex [split $arg] 1]
  1167. set type1 0
  1168. set chan1 "$chan"
  1169. set bdchan [lindex [split $arg] 2]
  1170. set type [lindex [split $arg] 3]
  1171. set reason [join [lrange [split $arg] 3 end]]
  1172. if {[string equal -nocase $type "global"]} {
  1173. set reason [join [lrange [split $arg] 4 end]]
  1174. }
  1175. if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
  1176. set chan "$why"
  1177. set why [lindex [split $arg] 2]
  1178. set bdchan [lindex [split $arg] 3]
  1179. set type [lindex [split $arg] 4]
  1180. set reason [join [lrange [split $arg] 4 end]]
  1181. if {[string equal -nocase $type "global"]} {
  1182. set reason [join [lrange [split $arg] 5 end]]
  1183. }
  1184. }
  1185. badchan:process $nick $char $hand $chan $chan1 $why $bdchan $type1 $type $reason
  1186. }
  1187. }
  1188. us {
  1189. if {[matchattr $hand nmo|MA $chan]} {
  1190. set type 0
  1191. set chan1 "$chan"
  1192. set users [lindex [split $arg] 1]
  1193. if {[regexp {^[&#]} $users] && [matchattr $hand nmo|MA $users]} {
  1194. set chan "$users"
  1195. set users [lindex [split $arg] 2]
  1196. }
  1197. us:process $nick $char $hand $chan $chan1 $users $type
  1198. }
  1199. }
  1200. s {
  1201. if {[matchattr $hand nmo|MA $chan]} {
  1202. set type 0
  1203. set chan1 "$chan"
  1204. set user [lindex [split $arg] 1]
  1205. set suspend_time [lindex [split $arg] 2]
  1206. set suspend_reason [join [lrange [split $arg] 3 end]]
  1207. if {![regexp {^[0-9]} $suspend_time]} {
  1208. set suspend_reason [join [lrange [split $arg] 2 end]]
  1209. }
  1210. if {[regexp {^[&#]} $user] && [matchattr $hand nmo|MA $user]} {
  1211. set chan "$user"
  1212. set user [lindex [split $arg] 2]
  1213. set suspend_time [lindex [split $arg] 3]
  1214. set suspend_reason [join [lrange [split $arg] 4 end]]
  1215. if {![regexp {^[0-9]} $suspend_time]} {
  1216. set suspend_reason [join [lrange [split $arg] 3 end]]
  1217. }
  1218. }
  1219. s:process $nick $char $hand $chan $chan1 $user $type $suspend_time $suspend_reason
  1220. }
  1221. }
  1222. info {
  1223. if {[matchattr $hand nmo|MASOV $chan]} {
  1224. set user [lindex [split $arg] 1]
  1225. set type 0
  1226. set chan1 "$chan"
  1227. if {[regexp {^[&#]} $user] && [matchattr $hand nmo|MASO $user] && ([lindex [split $arg] 2] == "")} {
  1228. set chan $user
  1229. info:process:chan $nick $char $hand $chan $chan1
  1230. return
  1231. }
  1232. if {[regexp {^[&#]} $user] && [matchattr $hand nmo|MASOV $chan]} {
  1233. set chan "$user"
  1234. set user [lindex [split $arg] 2]
  1235. }
  1236. info:process $nick $char $hand $chan $chan1 $user $type
  1237. }
  1238. }
  1239. channels {
  1240. if {[matchattr $hand nmo]} {
  1241. set chan1 "$chan"
  1242. channels:process $nick $char $hand $chan $chan1
  1243. }
  1244. }
  1245. userlist {
  1246. if {[matchattr $hand nmo|MASOV $chan]} {
  1247. set level [lindex [split $arg] 1]
  1248. set type 0
  1249. set chan1 "$chan"
  1250. if {[regexp {^[&#]} $level] && [matchattr $hand nmo|MASOV $level]} {
  1251. set chan "$level"
  1252. set level [lindex [split $arg] 2]
  1253. if {![validchan $chan]} {
  1254. blacktools:tell $nick $char $hand $chan $chan1 gl.novalidchan none
  1255. return
  1256. }
  1257. }
  1258. userlist:execute $hand $char $level $chan $chan1 $nick $type
  1259. }
  1260. }
  1261. chuser {
  1262. if {[matchattr $hand nmo|M $chan]} {
  1263. set user [lindex [split $arg] 1]
  1264. set type 0
  1265. set chan1 "$chan"
  1266. set chandle [lindex [split $arg] 2]
  1267. chuser:process $nick $char $hand $chan $chan1 $user $chandle $type
  1268. }
  1269. }
  1270. delhost {
  1271. if {[matchattr $hand nmo|MA $chan]} {
  1272. set user [lindex [split $arg] 1]
  1273. set type 0
  1274. set chan1 "$chan"
  1275. set hosts [lindex [split $arg] 2]
  1276. delhost:process $nick $char $hand $chan $chan1 $user $hosts $type
  1277. }
  1278. }
  1279. addhost {
  1280. if {[matchattr $hand nmo|MA $chan]} {
  1281. set arg [strip:all $arg]
  1282. set type 0
  1283. set chan1 "$chan"
  1284. set user [lindex [split $arg] 1]
  1285. set hosts [lindex [split $arg] 2]
  1286. addhost:process $nick $char $hand $chan $chan1 $user $hosts $type
  1287. }
  1288. }
  1289. del {
  1290. if {[matchattr $hand nmo|M $chan]} {
  1291. set args [lrange [split $arg] 1 end]
  1292. set type 0
  1293. set chan1 "$chan"
  1294. del:process $nick $char $hand $chan $chan1 $args $type
  1295. }
  1296. }
  1297. delacc {
  1298. if {[matchattr $hand nmo|MA $chan]} {
  1299. set args [lrange [split $arg] 1 end]
  1300. set type 0
  1301. set chan1 "$chan"
  1302. set c [lindex [split $arg] 1]
  1303. if {[regexp {^[&#]} $c] && [matchattr $hand nmo|AM $c]} {
  1304. set chan "$c"
  1305. set args [lrange [split $arg] 2 end]
  1306. }
  1307. foreach user $args {
  1308. delacc:process $nick $char $hand $chan $chan1 $user $type
  1309. }
  1310. }
  1311. }
  1312. add {
  1313. if {[matchattr $hand nmo|MA $chan]} {
  1314. set arg [strip:all $arg]
  1315. set level [lindex [split $arg] 1]
  1316. set type 0
  1317. set chan1 "$chan"
  1318. set args [lrange [split $arg] 2 end]
  1319. set handle ""
  1320. set uhost ""
  1321. if {[regexp {^[&#]} $level] && [matchattr $hand nmo|MA $level]} {
  1322. set chan "$level"
  1323. set level [lindex [split $arg] 2]
  1324. set args [lrange [split $arg] 3 end]
  1325. }
  1326. if {$args != ""} {
  1327. if {[string equal -nocase $level [blacktools:getlevelname 9 $hand]]} {
  1328. set user [lindex $args 0]
  1329. set reason [join [lrange $args 1 end]]
  1330. if {$user != ""} {
  1331. if {[validchan $chan] && [onchan $user $chan]} {
  1332. set handle [nick2hand $user]
  1333. set hosts [getchanhost $user $chan]
  1334. set uhost [return_mask $black(hostdefaultadd) $hosts $user]
  1335. add:process $user $uhost $handle $level $hand $char $chan $chan1 $nick $type "add" $reason "ban"
  1336. } else {
  1337. if {![string is alnum $user]} {
  1338. blacktools:tell $nick $char $hand $chan $chan1 add.18 none
  1339. continue
  1340. }
  1341. add:process $user $uhost $handle $level $hand $char $chan $chan1 $nick $type "add" $reason "ban"
  1342. }
  1343. }
  1344. return
  1345. }
  1346. foreach user $args {
  1347. if {$user != ""} {
  1348. if {[validchan $chan] && [onchan $user $chan]} {
  1349. set handle [nick2hand $user]
  1350. set hosts [getchanhost $user $chan]
  1351. set uhost [return_mask $black(hostdefaultadd) $hosts $user]
  1352. add:process $user $uhost $handle $level $hand $char $chan $chan1 $nick $type "add" "" ""
  1353. continue
  1354. } else {
  1355. if {![string is alnum $user]} {
  1356. blacktools:tell $nick $char $hand $chan $chan1 add.18 none
  1357. continue
  1358. }
  1359. add:process $user $uhost $handle $level $hand $char $chan $chan1 $nick $type "add" "" ""
  1360. }
  1361. }
  1362. }
  1363. } else { add:process "" $uhost $handle $level $hand $char $chan $chan1 $nick $type "add" "" "" }
  1364. }
  1365. }
  1366. unsuspend {
  1367. if {[matchattr $hand nmo]} {
  1368. set cmd_status [btcmd:status $chan $hand "unsuspend" 0]
  1369. if {$cmd_status == "1"} {
  1370. return
  1371. }
  1372. if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
  1373. return
  1374. }
  1375. set chans [lindex [split $arg] 1]
  1376. set chan1 "$chan"
  1377. if {$chans == ""} {blacktools:tell $nick $char $hand $chan $chan1 gl.instr_nick "unsuspend"
  1378. return
  1379. }
  1380. if {![regexp {^[&#]} $chans]} {
  1381. blacktools:tell $nick $char $hand $chan $chan1 gl.novalidchan none
  1382. return
  1383. }
  1384. if {![validchan $chans]} { blacktools:tell $nick $char $hand $chan $chan1 gl.novalidchan none
  1385. return
  1386. }
  1387. if {![channel get $chans inactive]} {
  1388. blacktools:tell $nick $char $hand $chan $chan1 unsuspend.3 $chans
  1389. return
  1390. }
  1391. channel set $chans -inactive
  1392. blacktools:tell $nick $char $hand $chan $chan1 unsuspend.4 $chans
  1393. }
  1394. }
  1395. suspend {
  1396. if {[matchattr $hand nmo]} {
  1397. set cmd_status [btcmd:status $chan $hand "suspend" 0]
  1398. if {$cmd_status == "1"} {
  1399. return
  1400. }
  1401. if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
  1402. return
  1403. }
  1404. set chans [lindex [split $arg] 1]
  1405. set reason [join [lrange [split $arg] 2 end]]
  1406. set chan1 "$chan"
  1407. if {$chans == ""} {blacktools:tell $nick $char $hand $chan $chan1 gl.instr_nick "suspend"
  1408. return
  1409. }
  1410. if {![regexp {^[&#]} $chans]} {
  1411. blacktools:tell $nick $char $hand $chan $chan1 gl.novalidchan none
  1412. return
  1413. }
  1414. if {![validchan $chans]} { blacktools:tell $nick $char $hand $chan $chan1 gl.novalidchan none
  1415. return
  1416. }
  1417. if {[channel get $chans inactive]} {
  1418. blacktools:tell $nick $char $hand $chan $chan1 suspend.3 $chans
  1419. return
  1420. }
  1421. channel set $chans +inactive
  1422. if {$reason == ""} { set reason "N/A" }
  1423. suspendchan:note $hand $chans $reason
  1424. blacktools:tell $nick $char $hand $chan $chan1 suspend.4 $chans
  1425. }
  1426. }
  1427. delchan {
  1428. if {[matchattr $hand nmo]} {
  1429. set cmd_status [btcmd:status $chan $hand "delchan" 0]
  1430. if {$cmd_status == "1"} {
  1431. return
  1432. }
  1433. if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
  1434. return
  1435. }
  1436. set chans [lindex [split $arg] 1]
  1437. set reason [join [lrange [split $arg] 2 end]]
  1438. set chan1 "$chan"
  1439. if {$chans == ""} {
  1440. blacktools:tell $nick $char $hand $chan $chan1 gl.instr_nick "delchan"
  1441. return
  1442. }
  1443. if {![regexp {^[&#]} $chans]} {
  1444. blacktools:tell $nick $char $hand $chan $chan1 gl.novalidchan none
  1445. return
  1446. }
  1447. if {![validchan $chans]} { blacktools:tell $nick $char $hand $chan $chan1 gl.novalidchan none
  1448. return
  1449. }
  1450. set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
  1451. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1452. if {!($black(homechan) == "") && ![string equal -nocase $black(homechan) "#no_home_chan"]} {
  1453. if {[string equal -nocase $chans $black(homechan)]} {
  1454. blacktools:tell $nick $char $hand $chan $chan1 delchan.5 $chans
  1455. return
  1456. }
  1457. }
  1458. channel remove $chans
  1459. delchan:all $chans
  1460. if {$reason == ""} { set reason "N/A" }
  1461. delchan:note $hand $chans $reason
  1462. blacktools:tell $nick $char $hand $chan $chan1 delchan.3 $chans
  1463. }
  1464. }
  1465. addchan {
  1466. if {[matchattr $hand nmo]} {
  1467. set cmd_status [btcmd:status $chan $hand "addchan" 0]
  1468. if {$cmd_status == "1"} {
  1469. return
  1470. }
  1471. if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
  1472. return
  1473. }
  1474. set chans [lindex [split $arg] 1]
  1475. set key [lindex [split $arg] 2]
  1476. set chan1 $chan
  1477. if {$chans == ""} {
  1478. blacktools:tell $nick $char $hand $chan $chan1 gl.instr_nick "addchan"
  1479. return
  1480. }
  1481. if {![regexp {^[&#]} $chans]} {
  1482. blacktools:tell $nick $char $hand $chan $chan1 gl.novalidchan none
  1483. return
  1484. }
  1485. if {[validchan $chans]} {
  1486. blacktools:tell $nick $char $hand $chan $chan1 addchan.2 $chans
  1487. return
  1488. } else {
  1489. channel add $chans
  1490. blacktools:tell $nick $char $hand $chan $chan1 addchan.3 $chans
  1491. if {$key != ""} {
  1492. putquick "JOIN $chans :$key"
  1493. channel set $chans chanmode "+ntk $key"
  1494. }
  1495. }
  1496. }
  1497. }
  1498. die {
  1499. if {[matchattr $hand nm]} {
  1500. set cmd_status [btcmd:status $chan $hand "die" 0]
  1501. if {$cmd_status == "1"} {
  1502. return
  1503. }
  1504. if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
  1505. return
  1506. }
  1507. set chan1 "$chan"
  1508. set reason [join [lrange [split $arg] 1 end]]
  1509. set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
  1510. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1511. blacktools:tell $nick $char $hand $chan $chan1 die.1 none
  1512. if {$reason == ""} {
  1513. set text [black:color:set "" $black(say.$getlang.die.2)]
  1514. set reply [join $text]
  1515. set reason $reply
  1516. }
  1517. utimer 3 [list die $reason]
  1518. }
  1519. }
  1520. jump {
  1521. if {[matchattr $hand nm]} {
  1522. set cmd_status [btcmd:status $chan $hand "jump" 0]
  1523. if {$cmd_status == "1"} {
  1524. return
  1525. }
  1526. if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
  1527. return
  1528. }
  1529. set chan1 "$chan"
  1530. set serv [lindex [split $arg] 1]
  1531. if {$serv == ""} {
  1532. blacktools:tell $nick $char $hand $chan $chan1 jump.1 "..."
  1533. utimer 3 [list jump]
  1534. } else {
  1535. blacktools:tell $nick $char $hand $chan $chan1 jump.1 "\002$serv\002"
  1536. utimer 3 [list jump $serv]
  1537. }
  1538. }
  1539. }
  1540. save {
  1541. if {[matchattr $hand nm]} {
  1542. set cmd_status [btcmd:status $chan $hand "save" 0]
  1543. if {$cmd_status == "1"} {
  1544. return
  1545. }
  1546. if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
  1547. return
  1548. }
  1549. set chan1 "$chan"
  1550. blacktools:tell $nick $char $hand $chan $chan1 save.1 none
  1551. save
  1552. }
  1553. }
  1554. restart {
  1555. if {[matchattr $hand nm]} {
  1556. set cmd_status [btcmd:status $chan $hand "restart" 0]
  1557. if {$cmd_status == "1"} {
  1558. return
  1559. }
  1560. if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
  1561. return
  1562. }
  1563. set chan1 "$chan"
  1564. blacktools:tell $nick $char $hand $chan $chan1 restart.1 none
  1565. utimer 3 [list restart]
  1566. }
  1567. }
  1568. rehash {
  1569. if {[matchattr $hand nm]} {
  1570. set cmd_status [btcmd:status $chan $hand "rehash" 0]
  1571. if {$cmd_status == "1"} {
  1572. return
  1573. }
  1574. if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
  1575. return
  1576. }
  1577. set chan1 "$chan"
  1578. blacktools:tell $nick $char $hand $chan $chan1 rehash.1 none
  1579. rehash
  1580. }
  1581. }
  1582. update {
  1583. if {[matchattr $hand n]} {
  1584. if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
  1585. return
  1586. }
  1587. set what [lindex [split $arg] 1]
  1588. set option [lindex [split $arg] 2]
  1589. set type 0
  1590. update:process $nick $char $hand $chan $chan [list $what $option] $type
  1591. }
  1592. }
  1593. nick {
  1594. if {[matchattr $hand nm]} {
  1595. set thenick [lindex [split $arg] 1]
  1596. set chan1 $chan
  1597. set type 0
  1598. tempnick:process $thenick $nick $char $hand $chan $chan1 $type
  1599. }
  1600. }
  1601. msg {
  1602. if {[matchattr $hand nmo|- $chan]} {
  1603. set who [lindex [split $arg] 1]
  1604. set chan1 "$chan"
  1605. set type 0
  1606. set msg [join [lrange [split $arg] 2 end]]
  1607. msg:process $nick $char $hand $chan $chan1 $who $msg $type
  1608. }
  1609. }
  1610. omsg {
  1611. if {[matchattr $hand nmo|OMA $chan]} {
  1612. set who [lindex [split $arg] 1]
  1613. set chan1 "$chan"
  1614. set type 0
  1615. set msg [join [lrange [split $arg] 2 end]]
  1616. if {![regexp {^[&#]} $who] && ![string equal -nocase $who "all"]} {
  1617. set msg [join [lrange [split $arg] 1 end]]
  1618. set who $chan
  1619. }
  1620. omsg:process $nick $char $hand $chan $chan1 $who $msg $type
  1621. }
  1622. }
  1623. set {
  1624. if {[matchattr $hand nmo|M $chan]} {
  1625. set flags [lindex [split $arg] 1]
  1626. set type [join [lrange [split $arg] 2 end]]
  1627. set type1 0
  1628. set chan1 "$chan"
  1629. if {[regexp {^[&#]} $flags] && [matchattr $hand nmo|M $flags]} {
  1630. set chan "$flags"
  1631. set flags [lindex [split $arg] 2]
  1632. set type [join [lrange [split $arg] 3 end]]
  1633. }
  1634. if {[matchattr $hand mn]} {
  1635. if {[string equal -nocase "global" $flags]} {
  1636. set chan "$flags"
  1637. set flags [lindex [split $arg] 2]
  1638. set type [join [lrange [split $arg] 3 end]]
  1639. foreach c [channels] {
  1640. set:process $nick $char $hand $c $chan1 $flags $type $type1
  1641. }
  1642. return
  1643. }
  1644. }
  1645. foreach c [channels] {
  1646. set backchan [join [setting:get $c backchan]]
  1647. if {[string match -nocase $chan $backchan]} {
  1648. set chan "$c"
  1649. }
  1650. }
  1651. set:process $nick $char $hand $chan $chan1 $flags $type $type1
  1652. }
  1653. }
  1654. mode {
  1655. if {[matchattr $hand nmo|OMA $chan]} {
  1656. set modes [lindex [split $arg] 1]
  1657. set hosts [lindex [split $arg] 2]
  1658. set type 0
  1659. set chan1 "$chan"
  1660. if {[regexp {^[&#]} $modes] && [matchattr $hand nmo|OMA $modes]} {
  1661. set chan "$modes"
  1662. set modes [lindex [split $arg] 2]
  1663. set hosts [lindex [split $arg] 3]
  1664. }
  1665. mode:process $nick $char $hand $chan $chan1 $modes $type $hosts
  1666. }
  1667. }
  1668. cycle {
  1669. if {[matchattr $hand nmo|OMA $chan]} {
  1670. set reason [join [lrange [split $arg] 1 end]]
  1671. set c [lindex [split $arg] 1]
  1672. set chan1 "$chan"
  1673. if {[regexp {^[&#]} $c] && [matchattr $hand nmo|OMA $c]} {
  1674. set chan "$c"
  1675. set reason [join [lrange [split $arg] 2 end]]
  1676. }
  1677. cycle:process $nick $char $hand $chan $chan1 $reason
  1678. }
  1679. }
  1680. purge {
  1681. if {[matchattr $hand -|M $chan]} {
  1682. set c [lindex [split $arg] 1]
  1683. set reason [join [lrange [split $arg] 1 end]]
  1684. set chan1 "$chan"
  1685. if {[regexp {^[&#]} $c] && [matchattr $hand -|M $c]} {
  1686. set chan "$c"
  1687. set reason [join [lrange [split $arg] 2 end]]
  1688. }
  1689. if {$reason == ""} {
  1690. blacktools:tell $nick $char $hand $chan $chan1 purge.1 none
  1691. return
  1692. }
  1693. purge:process $nick $char $hand $chan $chan1 $reason
  1694. }
  1695. }
  1696. broadcast {
  1697. if {[matchattr $hand nm]} {
  1698. set text [join [lrange [split $arg] 1 end]]
  1699. set chan1 "$chan"
  1700. set type 0
  1701. broadcast:cmd:process $nick $char $hand $chan $chan1 $text $type
  1702. }
  1703. }
  1704. act {
  1705. if {[matchattr $hand nmo|MA $chan]} {
  1706. set text [join [lrange [split $arg] 1 end]]
  1707. set c [lindex [split $arg] 1]
  1708. set type 0
  1709. set chan1 "$chan"
  1710. if {[regexp {^[&#]} $c] && [matchattr $hand nmo|AM $c]} {
  1711. set chan "$c"
  1712. set text [join [lrange [split $arg] 2 end]]
  1713. }
  1714. act:process $nick $char $hand $chan $chan1 $text $type
  1715. }
  1716. }
  1717. say {
  1718. if {[matchattr $hand nmo|MA $chan]} {
  1719. set text [join [lrange [split $arg] 1 end]]
  1720. set c [lindex [split $arg] 1]
  1721. set type 0
  1722. set chan1 "$chan"
  1723. if {[regexp {^[&#]} $c] && [matchattr $hand nmo|MA $c]} {
  1724. set chan "$c"
  1725. set text [join [lrange [split $arg] 2 end]]
  1726. }
  1727. say:process $nick $char $hand $chan $chan1 $text $type
  1728. }
  1729. }
  1730. v {
  1731. if {[matchattr $hand nmo|VOMA $chan]} {
  1732. set voicex [join [lrange [split $arg] 1 end]]
  1733. set c [lindex [split $arg] 1]
  1734. set chan1 "$chan"
  1735. if {[regexp {^[&#]} $c] && [matchattr $hand nmo|VOMA $c]} {
  1736. set chan "$c"
  1737. set voicex [join [lrange [split $arg] 2 end]]
  1738. }
  1739. v:process $nick $char $hand $chan $chan1 $voicex
  1740. }
  1741. }
  1742. ho {
  1743. if {[matchattr $hand nmo|OMA $chan]} {
  1744. set hopex [join [lrange [split $arg] 1 end]]
  1745. set c [lindex [split $arg] 1]
  1746. set chan1 "$chan"
  1747. if {[regexp {^[&#]} $c] && [matchattr $hand nmo|OMA $c]} {
  1748. set chan "$c"
  1749. set hopex [join [lrange [split $arg] 2 end]]
  1750. }
  1751. ho:process $nick $char $hand $chan $chan1 $hopex
  1752. }
  1753. }
  1754. o {
  1755. if {[matchattr $hand nmo|OMA $chan]} {
  1756. set opex [join [lrange [split $arg] 1 end]]
  1757. set c [lindex [split $arg] 1]
  1758. set chan1 "$chan"
  1759. if {[regexp {^[&#]} $c] && [matchattr $hand nmo|OMA $c]} {
  1760. set chan "$c"
  1761. set opex [join [lrange [split $arg] 2 end]]
  1762. }
  1763. o:process $nick $char $hand $chan $chan1 $opex
  1764. }
  1765. }
  1766. uptime {
  1767. if {[matchattr $hand nmo]} {
  1768. set cmd_status [btcmd:status $chan $hand "uptime" 0]
  1769. if {$cmd_status == "1"} {
  1770. return
  1771. }
  1772. set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
  1773. if {[matchattr $hand q]} { blacktools:tell $nick $char $hand $chan $chan1 gl.glsuspend none
  1774. return
  1775. }
  1776. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $char $hand $chan $chan1 gl.suspend none
  1777. return
  1778. }
  1779. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1780. set chan1 "$chan"
  1781. set up [return_time_2 $getlang [expr [unixtime] - $uptime]]
  1782. set on [return_time_2 $getlang [expr [unixtime] - ${server-online}]]
  1783. catch {exec uptime} shelluptime
  1784. set file [open $black(uptime_file) "r"]
  1785. set data [read -nonewline $file]
  1786. close $file
  1787. if {$data == ""} {
  1788. set read_maxup "-"
  1789. set read_maxon "-"
  1790. } else {
  1791. set read_maxup [return_time_2 $getlang [lindex [split $data] 0]]
  1792. set read_maxon [return_time_2 $getlang [lindex [split $data] 1]]
  1793. }
  1794. blacktools:tell $nick $char $hand $chan $chan1 maxup.1 "$up $read_maxup"
  1795. blacktools:tell $nick $char $hand $chan $chan1 maxon.1 "$on $read_maxon"
  1796. blacktools:tell $nick $char $hand $chan $chan1 uptime.2 $shelluptime
  1797. blacktools:tell $nick $char $hand $chan $chan1 uptime.3 $server
  1798. }
  1799. }
  1800. status {
  1801. if {[matchattr $hand nmo|- $chan]} {
  1802. status:process $nick $char $hand $chan
  1803. }
  1804. }
  1805. t {
  1806. if {[matchattr $hand nmo|OMA $chan]} {
  1807. set topics [join [lrange [split $arg] 1 end]]
  1808. set c [lindex [split $arg] 1]
  1809. set type 0
  1810. set chan1 "$chan"
  1811. if {[regexp {^[&#]} $c] && [matchattr $hand nmo|OMA $c]} {
  1812. set chan "$c"
  1813. set topics [join [lrange [split $arg] 2 end]]
  1814. }
  1815. t:process $nick $char $hand $chan $chan1 $topics $type
  1816. }
  1817. }
  1818. k {
  1819. if {[matchattr $hand nmo|OMA $chan]} {
  1820. set knick [lindex [split $arg] 1]
  1821. set type 0
  1822. set reason [join [lrange [split $arg] 2 end]]
  1823. set handle [nick2hand $knick]
  1824. set chan1 "$chan"
  1825. if {[regexp {^[&#]} $knick] && [matchattr $hand nmo|MAO $knick]} {
  1826. set chan "$knick"
  1827. set knick [lindex [split $arg] 2]
  1828. set reason [join [lrange [split $arg] 3 end]]
  1829. }
  1830. foreach c [channels] {
  1831. set backchan [join [setting:get $c backchan]]
  1832. if {[string match -nocase $chan $backchan]} {
  1833. set chan "$c"
  1834. }
  1835. }
  1836. if {$knick != ""} {
  1837. k:process $knick $nick $hand $char $reason $chan $chan1 $type
  1838. } else {k:process $knick $nick $hand $char $reason $chan $chan1 $type}
  1839. }
  1840. }
  1841. w {
  1842. if {[matchattr $hand nmo|OMA $chan]} {
  1843. set wnick [lindex [split $arg] 1]
  1844. set type 0
  1845. set handle [nick2hand $wnick]
  1846. set chan1 "$chan"
  1847. if {[regexp {^[&#]} $wnick] && [matchattr $hand nmo|MAO $wnick]} {
  1848. set chan "$wnick"
  1849. set wnick [lindex [split $arg] 2]
  1850. }
  1851. foreach c [channels] {
  1852. set backchan [join [setting:get $c backchan]]
  1853. if {[string match -nocase $chan $backchan]} {
  1854. set chan "$c"
  1855. }
  1856. }
  1857. if {$wnick != ""} {
  1858. w:process $wnick $nick $hand $char $chan $chan1 $type
  1859. } else { w:process $wnick $nick $hand $char $chan $chan1 $type }
  1860. }
  1861. }
  1862. ungag {
  1863. if {[matchattr $hand nmo|OMA $chan]} {
  1864. set gagger [lindex [split $arg] 1]
  1865. set type 0
  1866. set chan1 "$chan"
  1867. if {[regexp {^[&#]} $gagger] && [matchattr $hand nmo|MAO $gagger]} {
  1868. set chan "$gagger"
  1869. set gagger [lindex [split $arg] 2]
  1870. }
  1871. foreach c [channels] {
  1872. set backchan [join [setting:get $c backchan]]
  1873. if {[string match -nocase $chan $backchan]} {
  1874. set chan "$c"
  1875. }
  1876. }
  1877. if {$gagger != ""} {
  1878. ungag:process $gagger $nick $hand $char $chan $chan1 $type
  1879. } else { ungag:process $gagger $nick $hand $char $chan $chan1 $type }
  1880. }
  1881. }
  1882. gag {
  1883. if {[matchattr $hand nmo|OMA $chan]} {
  1884. set gagger [lindex [split $arg] 1]
  1885. set time [lindex [split $arg] 2]
  1886. set reason [join [lrange [split $arg] 3 end]]
  1887. set type 0
  1888. set handle [nick2hand $gagger]
  1889. set chan1 "$chan"
  1890. set return_time [time_return_minute $time]
  1891. foreach c [channels] {
  1892. set backchan [join [setting:get $c backchan]]
  1893. if {[string match -nocase $chan $backchan]} {
  1894. set chan "$c"
  1895. }
  1896. }
  1897. if {$return_time == "-1"} {
  1898. set reason [lrange [split $arg] 2 end]
  1899. set time [setting:get $chan gag-bantime]
  1900. if {$time == ""} {
  1901. set time $black(gag:bantime)
  1902. }
  1903. }
  1904. if {[regexp {^[&#]} $gagger] && [matchattr $hand nmo|MAO $gagger]} {
  1905. set chan "$gagger"
  1906. set gagger [lindex [split $arg] 2]
  1907. set time [lindex [split $arg] 3]
  1908. set reason [join [lrange [split $arg] 4 end]]
  1909. set return_time [time_return_minute $time]
  1910. if {$return_time == "-1"} {
  1911. set reason [lrange [split $arg] 3 end]
  1912. set time [setting:get $chan gag-bantime]
  1913. if {$time == ""} {
  1914. set time $black(gag:bantime)
  1915. }
  1916. }
  1917. }
  1918. if {$gagger != ""} {
  1919. gag:process $gagger $time $reason $nick "$hand:GAG" $char $chan $chan1 $type
  1920. } else { gag:process $gagger $time $reason $nick $hand $char $chan $chan1 $type }
  1921. }
  1922. }
  1923. show {
  1924. if {[matchattr $hand nmo|M $chan]} {
  1925. set wich [lindex [split $arg] 1]
  1926. set type 0
  1927. set chan1 "$chan"
  1928. if {[regexp {^[&#]} $wich] && [matchattr $hand nmo|M $wich]} {
  1929. set chan "$wich"
  1930. set wich [lindex [split $arg] 2]
  1931. }
  1932. foreach c [channels] {
  1933. set backchan [join [setting:get $c backchan]]
  1934. if {[string match -nocase $chan $backchan]} {
  1935. set chan "$c"
  1936. }
  1937. }
  1938. show:process $nick $char $hand $chan $chan1 $wich $type
  1939. }
  1940. }
  1941. clonescan {
  1942. if {[matchattr $hand nmo|MAO $chan]} {
  1943. set why [lindex [split $arg] 1]
  1944. set type 0
  1945. if {[matchattr $hand nmo|M $chan] && ($why != "") && ![regexp {^[&#]} $why]} {
  1946. set chan1 "$chan"
  1947. set clone [join [lrange [split $arg] 2 end]]
  1948. set number [lindex [split $arg] 2]
  1949. if {[regexp {^[&#]} $why]} {
  1950. set chan "$why"
  1951. set why [lindex [split $arg] 2]
  1952. set clone [join [lrange [split $arg] 3 end]]
  1953. set number [lindex [split $arg] 3]
  1954. }
  1955. prot:module:process $nick $char $hand $chan $chan1 $why $clone $type $number "clonescan"
  1956. return
  1957. }
  1958. set c [lindex [split $arg] 1]
  1959. set type 0
  1960. set chan1 "$chan"
  1961. if {[regexp {^[&#]} $c] && [matchattr $hand nmo|M $c]} {
  1962. set chan "$c"
  1963. }
  1964. scanner:process $nick $char $hand $chan $chan1 $type
  1965. }
  1966. }
  1967. topwords {
  1968. if {[matchattr $hand nmo|AOMV $chan]} {
  1969. set chan1 "$chan"
  1970. set cmd ""
  1971. set type 0
  1972. set next [lindex [split $arg] 1]
  1973. if {[regexp {^[&#]} $next] && [matchattr $hand nmo|MAOV $next]} {
  1974. set chan $next
  1975. set next [lindex [split $arg] 2]
  1976. switch $next {
  1977. reset {
  1978. if {[matchattr $hand nmo|M $chan]} {
  1979. set next [lindex [split $arg] 3]
  1980. set cmd "reset"
  1981. }
  1982. }
  1983. total {
  1984. set next [lindex [split $arg] 3]
  1985. set cmd "total"
  1986. }
  1987. week {
  1988. set next [lindex [split $arg] 3]
  1989. set cmd "week"
  1990. }
  1991. add {
  1992. if {[matchattr $hand nmo|M $chan]} {
  1993. set next [lindex [split $arg] 3]
  1994. set cmd "add"
  1995. }
  1996. }
  1997. del {
  1998. if {[matchattr $hand nmo|M $chan]} {
  1999. set next [lindex [split $arg] 3]
  2000. set cmd "del"
  2001. }
  2002. }
  2003. list {
  2004. if {[matchattr $hand nmo|M $chan]} {
  2005. set next [lindex [split $arg] 3]
  2006. set cmd "list"
  2007. }
  2008. }
  2009. default {
  2010. if {[matchattr $hand nmo|MAOV $next]} {
  2011. if {$next != "" && ![string equal -nocase $next "-next"]} {
  2012. set cmd $next
  2013. set next [lindex [split $arg] 3]
  2014. switch $next {
  2015. total {
  2016. set cmd "total:$cmd"
  2017. }
  2018. week {
  2019. set cmd "week:$cmd"
  2020. }
  2021. reset {
  2022. set cmd "reset:$cmd"
  2023. }
  2024. default {
  2025. set cmd "user:$cmd"
  2026. }
  2027. }
  2028. }
  2029. }
  2030. }
  2031. }
  2032. }
  2033. if {$cmd == ""} {
  2034. switch $next {
  2035. reset {
  2036. if {[matchattr $hand nmo|M $chan]} {
  2037. set next [lindex [split $arg] 2]
  2038. set cmd "reset"
  2039. }
  2040. }
  2041. total {
  2042. set next [lindex [split $arg] 2]
  2043. set cmd "total"
  2044. }
  2045. week {
  2046. set next [lindex [split $arg] 2]
  2047. set cmd "week"
  2048. }
  2049. add {
  2050. if {[matchattr $hand nmo|M $chan]} {
  2051. set next [lindex [split $arg] 2]
  2052. set cmd "add"
  2053. }
  2054. }
  2055. del {
  2056. if {[matchattr $hand nmo|M $chan]} {
  2057. set next [lindex [split $arg] 2]
  2058. set cmd "del"
  2059. }
  2060. }
  2061. list {
  2062. if {[matchattr $hand nmo|M $chan]} {
  2063. set next [lindex [split $arg] 2]
  2064. set cmd "list"
  2065. }
  2066. }
  2067. default {
  2068. if {$next != "" && ![string equal -nocase $next "-next"]} {
  2069. if {[matchattr $hand nmo|MAOV $chan]} {
  2070. set cmd $next
  2071. set next [lindex [split $arg] 2]
  2072. switch $next {
  2073. total {
  2074. set cmd "total:$cmd"
  2075. }
  2076. week {
  2077. set cmd "week:$cmd"
  2078. }
  2079. reset {
  2080. set cmd "reset:$cmd"
  2081. }
  2082. default {
  2083. set cmd "user:$cmd"
  2084. }
  2085. }
  2086. }
  2087. }
  2088. }
  2089. }
  2090. }
  2091. topwords:process $nick $char $hand $chan $chan1 $cmd $type $next
  2092. }
  2093. }
  2094. myset {
  2095. if {[matchattr $hand nmo|VAOM $chan]} {
  2096. set arg [strip:all $arg]
  2097. set type 0
  2098. set chan1 "$chan"
  2099. set flags [lindex [split $arg] 1]
  2100. set typez [lindex [split $arg] 2]
  2101. set chan2 [lindex [split $arg] 3]
  2102. set arg [join [lrange [split $arg] 2 end]]
  2103. myset:process $nick $char $hand $chan $chan1 $flags $typez $type $chan2 $arg
  2104. }
  2105. }
  2106. timer {
  2107. if {[matchattr $hand nm]} {
  2108. set chan1 $chan
  2109. set cmd [lindex [split $arg] 1]
  2110. set pid [lindex [split $arg] 2]
  2111. set timer_args [join [lrange [split $arg] 3 end]]
  2112. set type 0
  2113. timer:process $nick $char $hand $chan $chan1 $cmd $pid $timer_args $type
  2114. }
  2115. }
  2116. i {
  2117. if {[matchattr $hand nmo|VAOM $chan]} {
  2118. set type 0
  2119. set chan1 "$chan"
  2120. set inick [lindex [split $arg] 1]
  2121. if {[regexp {^[&#]} $inick] && [matchattr $hand nmo|VAOM $inick]} {
  2122. set chan "$inick"
  2123. set inick [lindex [split $arg] 2]
  2124. }
  2125. i:process $nick $char $hand $chan $chan1 $inick $type
  2126. }
  2127. }
  2128. badword {
  2129. if {[matchattr $hand nmo|M $chan]} {
  2130. set why [lindex [split $arg] 1]
  2131. set type 0
  2132. set chan1 "$chan"
  2133. set bdword [join [lrange [split $arg] 2 end]]
  2134. set bdnumber [lindex [split $arg] 2]
  2135. if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
  2136. set chan "$why"
  2137. set why [lindex [split $arg] 2]
  2138. set bdnumber [lindex [split $arg] 3]
  2139. set bdword [join [lrange [split $arg] 3 end]]
  2140. }
  2141. antibadword:command:process $nick $char $hand $chan $chan1 $why $bdword $bdnumber $type
  2142. }
  2143. }
  2144. next {
  2145. if {[matchattr $hand nmo|MAO $chan]} {
  2146. set option [lindex [split $arg] 1]
  2147. set chan1 $chan
  2148. nextpublic:process $nick $char $hand $chan $chan1 $option
  2149. }
  2150. }
  2151. helped {
  2152. if {[matchattr $hand nmo|MAO $chan]} {
  2153. set user [lindex [split $arg] 1]
  2154. set chan1 $chan
  2155. set type 0
  2156. helpedpublic:process $nick $char $hand $chan $chan1 $user $type
  2157. }
  2158. }
  2159. noidle {
  2160. if {[matchattr $hand nmo|MAO $chan]} {
  2161. set user [lindex [split $arg] 1]
  2162. set chan1 $chan
  2163. set type 0
  2164. noidlepublic:process $nick $char $hand $chan $chan1 $user $type
  2165. }
  2166. }
  2167. skip {
  2168. if {[matchattr $hand nmo|MAO $chan]} {
  2169. set user [lindex [split $arg] 1]
  2170. set chan1 $chan
  2171. set type 0
  2172. skippublic:process $nick $char $hand $chan $chan1 $user $type
  2173. }
  2174. }
  2175. default {
  2176. set alias_check [blacktools:alias_check $hand $cmd]
  2177. if {$alias_check != 0} {
  2178. set counter 0
  2179. set text [lrange [split $arg] 1 end]
  2180. foreach a $text {
  2181. incr counter
  2182. set replace(%${counter}%) $a
  2183. }
  2184. set replace(%chan%) $chan
  2185. set text [string map [array get replace] $alias_check]
  2186. regsub -all {%[0-9]%} $text "" text
  2187. set text [join $text]
  2188. comand:chan $nick $host $hand $chan "${char}$text"
  2189. }
  2190. }
  2191. }
  2192. }
  2193. ##############
  2194. #########################################################################
  2195. ## END ##
  2196. #########################################################################