BT.ChanCmds.tcl 60 KB

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