BT.MeCmds.tcl 56 KB

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