BT.ForCmds.tcl 56 KB

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