BT.ForCmds.tcl 56 KB

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