BT.ForCmds.tcl 56 KB

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