BT.ChanCmds.tcl 60 KB

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