BT.ForCmds.tcl 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185
  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. set split_cmd [wsplit $alias_check "|"]
  2034. set llength_cmd [llength $split_cmd]
  2035. foreach a $text {
  2036. incr counter
  2037. set replace(%${counter}%) $a
  2038. }
  2039. set replace(%chan%) $chan
  2040. for {set i 0} { $i < $llength_cmd} {incr i} {
  2041. set text [string map [array get replace] [lindex $split_cmd $i]]
  2042. regsub -all {%[0-9]%} $text "" text
  2043. set text [concat [join $text]]
  2044. comand:pubme:for $nick $host $hand $chan "for ${botnick} $text"
  2045. }
  2046. }
  2047. }
  2048. }
  2049. }
  2050. }
  2051. ##############
  2052. #########################################################################
  2053. ## END ##
  2054. #########################################################################