Advertisement
Guest User

Untitled

a guest
Jul 16th, 2012
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.00 KB | None | 0 0
  1. #================================================================================#
  2. # Information d'utilisation #
  3. #================================================================================#
  4. # Les Commandes actives via ce Tcl sont: #
  5. # #
  6. # .moderation --> Aide à la configuration de la modération. #
  7. # .listemot\002 (liste les mots)"
  8. # .effacermot <mot> efface un mot)"
  9. # .ajoutermot <mot> (ajoute un mot)" #
  10. # #
  11. # Commandes pour les canaux detection Pub #
  12. # .antipub listchan --> Liste des Channels Antipub #
  13. # .antipub <salon> off --> Efface un canal a surveiller #
  14. # .antipub <salon> on --> Ajoute un canal a surveiller #
  15. # #
  16. # Commandes pour les canaux detection Flood, Majuscule, Mots Interdit & Limite #
  17. # .modchan --> Liste les canaux #
  18. # .-modchan <salon> --> Efface un canal surveillé #
  19. # .+modchan <salon> --> Ajoute un canal a surveiller #
  20. # #
  21. #================================================================================#
  22.  
  23. #================================================================================#
  24. # Configuration.
  25. #--------------------------------------------------------------------------------#
  26. # Flag d'accé autoriser à configurer la Modération de l'Eggy.
  27. set moderation(flag) "m|m"
  28.  
  29. # Flag d'Exception pour ke la Modération de l'Eggy n'agisse pas sur une catégorie d'accés.
  30. set moderation(flagexept) "fo|fo"
  31.  
  32. #================================================================================#
  33. # Configuration de la Limite salon (mode +l...).
  34. #--------------------------------------------------------------------------------#
  35. #Indiquer ici de combien la limite doit etre augmenté
  36. set moderation(plus) 2
  37.  
  38. #================================================================================#
  39. # Configuration Publicité.
  40. #--------------------------------------------------------------------------------#
  41. # Temps apres lequel l'avertissement est oublié et le compteur des pub remis a zéro,
  42. # ce qui permets que si kkun fait de la pub UNE fois, se fait kicker pour warning,
  43. # et n'en refait que 2h plus tard, de pas le bannir (il risquerais de pas trop capter aussi)
  44. # par defaut le temps de remise a zero du compteur est de 30 minutes (1800 secondes)
  45. set moderation(pubtime) 1800
  46.  
  47. # nombre de recidive entrainant le ban (si =3 la personne pourra faire 3 fois de la pub sans etre inquiete
  48. # et sera banni a la 4 eme tentative... par defaut =1)
  49. set moderation(nb_check) 2
  50.  
  51. # liste des pubs interdites sur le channel.
  52. set moderation(pubnolist) {
  53. *.*.com
  54. *.*.fr
  55. *.*.net
  56. *.*.ru
  57. *.*.es
  58. *.*.ca
  59. *.*.org
  60. *.*.be
  61. *#*
  62. *.*@hotmail.com
  63. *.*@hotmail.fr
  64. *.*@msn.com
  65. *.*@msn.fr
  66. }
  67.  
  68. # liste des pubs autorisées sur le channel.
  69. set moderation(puboklist) {
  70. *.
  71. *.
  72. *#
  73. *#
  74. }
  75.  
  76. # prevenir avec un avertissement pour chaque pub envoyé dans le salon? 1/0
  77. set moderation(pubaverto) 1
  78.  
  79. # quel message?
  80. set moderation(pubavertomsg) "4Attention! Evitez vos Publicités! La prochaine fois vous serez Expulsé!"
  81.  
  82. # kicker pour pub? 1/0
  83. set moderation(pubkick) 1
  84.  
  85. # kel raison pour le kick?
  86. set moderation(pubkickraison) {
  87. "Exclu pour pub !"
  88. "Si tu veux faire de la pub c'est pas l'endroit"
  89. "Le salon a une tete de panneau publicitaire ?!"
  90. }
  91.  
  92. # bannir pour pub? 1/0
  93. set moderation(pubban) 1
  94.  
  95. # bannir combien de temps? (en minute)
  96. set moderation(pubbantime) 5
  97.  
  98. #================================================================================#
  99. # Configuration Mots Interdits.
  100. #--------------------------------------------------------------------------------#
  101. # prevenir 1 fois avant kick pour les badword? 1/0
  102. set moderation(badaverto) 1
  103.  
  104. # si on previent kel est le message a envoyer?
  105. set moderation(badavertomsg) "4Attention! surveillez votre langage! La prochaine fois vous serez Expulsé!"
  106.  
  107. # bannir pour badword? 1/0
  108. set moderation(badban) 1
  109.  
  110. # bannir combien de temps? (en minute)
  111. set moderation(badbantime) 2
  112.  
  113. # kicker pour badword? 1/0
  114. set moderation(badkick) 1
  115.  
  116. # kel raison pour le kick?
  117. set moderation(badkickraison) {
  118. "Exclu 10 minutes !"
  119. "Pas de ca ici stp"
  120. "Aux chiottes la vulgarité !"
  121. }
  122.  
  123. #================================================================================#
  124. # Configuration Répititions.
  125. #--------------------------------------------------------------------------------#
  126. # combien de repetion maxi?
  127. set moderation(repeatmax) 3
  128.  
  129. # raisons de kick random pour les repetions
  130. set moderation(repeatkickraison) {
  131. "pas besoin de répéter"
  132. "on ne répète pas"
  133. "tu nous dérange en répétant"
  134. }
  135.  
  136. # bannir pour repetition? 1/0
  137. set moderation(repeatban) 1
  138.  
  139. # combien de temps? (en minute)
  140. set moderation(repeatbantime) 2
  141.  
  142. #================================================================================#
  143. # Configuration Majuscule.
  144. #--------------------------------------------------------------------------------#
  145. # Max de Caps ?
  146. set moderation(majmax) 20
  147.  
  148. # prevenir la personne en notice ? 1/0
  149. set moderation(majaverto) 1
  150.  
  151. # quel message?
  152. set moderation(majavertomsg) "4Attention! Merci de ne pas ecrire en MAJUSCULE"
  153.  
  154. # kicker les CAPS ? 1/0
  155. set moderation(majkick) 0
  156.  
  157. # quel raison pour le kick?
  158. set moderation(majkickraison) {
  159. "Majuscule"
  160. "Pas la penne de crier on à compris!"
  161. "Stop Majuscule!!"
  162. }
  163.  
  164. #================================================================================#
  165. # Configuration Flood.
  166. #--------------------------------------------------------------------------------#
  167. # kicker les longs mots? 1/0
  168. set moderation(motkick) 1
  169.  
  170. # taille maxi d'un mot? 1/0
  171. set moderation(motmax) 200
  172.  
  173. # raison du kick ?
  174. set moderation(motkickraison) {
  175. "Flood"
  176. "Evite le flood"
  177. "Pas de flood stp"
  178. }
  179.  
  180. #================================================================================#
  181. # Configuration Répitition mot en une phrase.
  182. #--------------------------------------------------------------------------------#
  183. # Nombre max de fois où un mot est répeté dans une seul et unique phrase.
  184. set moderation(cptmotmax) 4
  185.  
  186. # kicker pour mot répété plusieur fois dans une seul et unique phrase? 1/0
  187. set moderation(cptmotick) 2
  188.  
  189. # kel raison pour le kick?
  190. set moderation(cptmotkickraison) "Exclu pour répétition en une seul phrase !"
  191. set moderation(cptmotkickraison) {
  192. "Exclu pour répétition en une seul phrase !"
  193. "Evite de répéter $moderation(cptmotmax) fois le meme mot dans une seul phrase stp"
  194. }
  195.  
  196. # bannir pour mot répété plusieur fois dans une seul et unique phrase? 1/0
  197. set moderation(cptmotban) 0
  198.  
  199. # bannir combien de temps? (en minute)
  200. set moderation(cptmotbantime) 10
  201.  
  202. #================================================================================#
  203. # Bind.
  204. #--------------------------------------------------------------------------------#
  205. bind dcc $moderation(flag) moderation moderation
  206. bind dcc $moderation(flag) antipub dcc_antipub
  207. bind dcc $moderation(flag) modchan listchan
  208. bind dcc $moderation(flag) -modchan effacerchan
  209. bind dcc $moderation(flag) +modchan ajouterchan
  210. bind dcc $moderation(flag) listemot listmot
  211. bind dcc $moderation(flag) effacermot effacermot
  212. bind dcc $moderation(flag) ajoutermot ajoutermot
  213.  
  214. bind time - "* * * * *" effacetemp
  215.  
  216. bind pubm - * chanpub
  217. bind pubm - * pubcheck
  218.  
  219. bind ctcp - action pubcheckactionsound
  220. bind ctcp - sound pubcheckactionsound
  221.  
  222. bind raw - notice pubchecknotice
  223.  
  224. #================================================================================#
  225. # Processus.
  226. #--------------------------------------------------------------------------------#
  227. proc moderation {hand idx args} {
  228. global moderation
  229. putdcc $idx " Commande Chan "
  230. putdcc $idx ""
  231. putdcc $idx "ce script comprend un anti mots-interdit, un anti répétition mot"
  232. putdcc $idx "un anti repetition phrase, un anti caps, un anti pub et un anti long mot."
  233. putdcc $idx "Il agit sur les msgs/notices/actions/sounds"
  234. putdcc $idx ""
  235. putdcc $idx "commandes pour les Badword"
  236. putdcc $idx "\002.listemot\002 14(liste les mots)"
  237. putdcc $idx "\002.effacermot\002 <mot> 14(efface un mot)"
  238. putdcc $idx "\002.ajoutermot\002 <mot> 14(ajoute un mot)"
  239. putdcc $idx ""
  240. putdcc $idx "commandes pour les canaux detection Pub"
  241. putdcc $idx "\002.antipub\002 14listchan (liste des Channels Antipub)"
  242. putdcc $idx "\002.antipub\002 14<salon> off (efface un canal a surveiller)"
  243. putdcc $idx "\002.antipub\002 14<salon> on (ajoute un canal a surveiller)"
  244. putdcc $idx ""
  245. putdcc $idx "commandes pour les canaux detection Flood, Majuscule & Badword"
  246. putdcc $idx "\002.modchan\002 14(liste les canaux)"
  247. putdcc $idx "\002.-modchan\002 14<salon> (efface un canal surveillé)"
  248. putdcc $idx "\002.+modchan\002 14<salon> (ajoute un canal a surveiller)"
  249. putdcc $idx ""
  250. putdcc $idx "Gebulon 7- 14anthony.larmier@wanadoo.fr"
  251. putdcc $idx ""
  252. return 1
  253. }
  254.  
  255. proc kickraison {} {
  256. global moderation
  257. return [lindex $moderation(repeatkickraison) [rand [llength $moderation(repeatkickraison)]]]
  258. }
  259.  
  260. set bwc ""
  261. foreach c [channels] {
  262. if {[file exists "moderation.[string tolower $c].list"]} {
  263. set f [open moderation.[string tolower $c].list r]
  264. set bwl([string tolower $c]) "[string tolower [gets $f]]"
  265. close $f
  266. lappend bwc [string tolower $c]
  267. }
  268. }
  269.  
  270. proc checkchall {cha} {
  271. global bwc
  272. foreach c $bwc {
  273. if {$c == "$cha"} {return 1; break}
  274. }
  275. return 0
  276. }
  277.  
  278. proc pubchecknotice {from keyword arg} {
  279. set from [split $from !]
  280. if {![validchan $from]} { return 0 }
  281. pubcheck [lindex $from 0] [lindex $from 1] * [lindex $arg 0] [lrange $arg 1 end]
  282. }
  283. proc pubcheckactionsound {nick userhost hand dest keyword text} {
  284. if {[string match &* $dest] || [string match #* $dest]} {
  285. pubcheck $nick $userhost $hand $dest $text
  286. }
  287. }
  288.  
  289. proc pubcheck {nick userhost handle channel text} {
  290. global bwn bwl bwc rpt moderation
  291. if {[isop $nick $channel]} { return 0 }
  292. if {[matchattr $handle $moderation(flagexept) $channel]} { return 0 }
  293. if {[checkchall [string tolower $channel]]} {
  294. set hostban [lindex [split $userhost @] 1]
  295. if {[info exists cptmot]} {
  296. unset cptmot
  297. }
  298. foreach {w} $text {
  299. if {[info exists cptmot($w)]} {
  300. set cptmot($w) [expr $cptmot($w) + 1]
  301. }
  302. if {![info exists cptmot($w)]} {
  303. set cptmot($w) 1
  304. }
  305. if {$cptmot($w) > $moderation(cptmotmax)} {
  306. if {$moderation(cptmotban)=="1"} {newchanban $channel *!*@$hostban moderation "$moderation(cptmotkickraison)" $moderation(cptmotbantime)}
  307. if {$moderation(cptmotick)=="1"} {
  308. putserv "KICK $channel $nick :$moderation(cptmotkickraison)"
  309. return 0
  310. }
  311. }
  312. }
  313. set templist [join [split [string tolower $text] "!&\"'(-_)=~\{\[|`\\^@\]\}\$%µ?,;:/§"]]
  314. foreach wdt $bwl([string tolower $channel]) {
  315. if {[lsearch -exact "$templist" $wdt] != -1} {
  316. if {$moderation(badaverto)} {
  317. if {![info exists bwn([string tolower $userhost])]} {
  318. putserv "NOTICE $nick :$moderation(badavertomsg)"
  319. set bwn([string tolower $userhost]) [expr [clock seconds] + 1800]
  320. } else {
  321. if {$moderation(badban)=="1"} {newchanban $channel *!*@$hostban moderation "$moderation(badkickraison)" $moderation(badbantime)}
  322. if {$moderation(badkick)=="1"} {putserv "KICK $channel $nick :$moderation(badkickraison)"}
  323. }
  324. return 1
  325. } else {
  326. if {$moderation(badban)=="1"} {newchanban $channel *!*@$hostban moderation "$moderation(badkickraison)" $moderation(badbantime)}
  327. if {$moderation(badkick)=="1"} {putserv "KICK $channel $nick :$moderation(badkickraison)"}
  328. return 1
  329. }
  330. }
  331. }
  332. regsub -all {\\} $text {\\\\} text
  333. regsub -all {\{} $text {\{} text
  334. regsub -all {\}} $text {\}} text
  335. regsub -all {\]} $text {\]} text
  336. regsub -all {\[} $text {\[} text
  337. regsub -all {\"} $text {\"} text
  338. if {[info exists rpt($nick)]} {
  339. if {[lrange $rpt($nick) 2 end] == "$text"} {
  340. set cnt [lindex $rpt($nick) 1]; incr cnt
  341. set rpt($nick) "[lindex $rpt($nick) 0] $cnt [lrange $rpt($nick) 2 end]"
  342. if {[lindex $rpt($nick) 1] > $moderation(repeatmax)} {
  343. putserv "KICK $channel $nick :[kickraison]"
  344. if {$moderation(repeatban)=="1"} {newchanban $channel *!*@$hostban moderation "Repeat" 10}
  345. unset rpt($nick)
  346. }
  347. } else {set rpt($nick) "[expr [clock seconds] + 10] 1 $text"}
  348. } else {set rpt($nick) "[expr [clock seconds] + 10] 1 $text"}
  349. set upper 0
  350. set space 0
  351. foreach i [split $text {}] {
  352. if [string match \[A-Z\] $i] {incr upper}
  353. if {$i == " "} {incr space}
  354. }
  355. if {$upper > $moderation(majmax)} {
  356. if {$moderation(majaverto)=="1"} {putserv "NOTICE $nick :$moderation(majavertomsg)"}
  357. if {$moderation(majkick)=="1"} {putserv "KICK $channel $nick :$moderation(majkickraison)"}
  358. }
  359. if {$space == 0 && [string length $text] > $moderation(motmax)} {
  360. if {$moderation(motkick)=="1"} {putserv "KICK $channel $nick :$moderation(motkickraison)"}
  361. }
  362. }
  363. }
  364.  
  365. proc zerotime {} {
  366. global rpt
  367. foreach nick [array names rpt] {
  368. if {[lindex $rpt($nick) 0] < [clock seconds]} {unset rpt($nick)}
  369. }
  370. utimer 5 zerotime
  371. }
  372.  
  373. foreach t [utimers] {
  374. if {[lindex $t 1] == "zerotime"} {killutimer [lindex $t 2]}
  375. }
  376. zerotime
  377.  
  378. proc effacetemp {min hour day month year} {
  379. global bwn rpt moderation
  380. foreach nt [array names bwn] {
  381. if {$bwn($nt) < [clock seconds]} {unset bwn($nt)}
  382. }
  383. set limite_actuelle 0
  384. foreach chan [channels] {
  385. if {[checkchall [string tolower $chan]]} {
  386. if {[string match *l* [lindex [getchanmode $chan] 0]]} {
  387. if {[string match *k* [lindex [getchanmode $chan] 0]]} {
  388. set limite_actuelle [lindex [getchanmode $chan] 2]
  389. } else {
  390. set limite_actuelle [lindex [getchanmode $chan] 1]
  391. }
  392. }
  393. if {![info exists moderation($chan,stop)]} {
  394. set moderation($chan,stop) 0
  395. }
  396. set moderation($chan,total) [llength [chanlist $chan]]
  397. if {![info exists moderation($chan,total,old)]} {
  398. set moderation($chan,total,old) $moderation($chan,total)
  399. }
  400. if {![info exists moderation($chan,danger)]} {
  401. set moderation($chan,danger) 1
  402. }
  403. if {$moderation($chan,total) == [expr $moderation($chan,total,old) + $moderation(plus)]} {
  404. if {![info exists moderation($chan,danger,moment)]} {
  405. set moderation($chan,danger,moment) "$hour:$min"
  406. }
  407. if {([lindex [split $moderation($chan,danger,moment) :] 0] == $hour) && ([expr [lindex [split $moderation($chan,danger,moment) :] 1] + 1] == $min)} {
  408. set moderation($chan,danger) [expr $moderation($chan,danger) + 1]
  409. }
  410.  
  411. }
  412. if {$moderation($chan,danger) == 2} {
  413. set moderation($chan,stop) 4
  414. set moderation($chan,danger) 1
  415. } else {
  416. if {$moderation($chan,stop) > 0} {
  417. set moderation($chan,stop) [expr $moderation($chan,stop) - 1]
  418. } else {
  419. if {$moderation($chan,danger) < 2} {
  420. if {$limite_actuelle != [expr $moderation($chan,total) + $moderation(plus)]} {
  421. pushmode $chan +l [expr $moderation($chan,total) + $moderation(plus)]
  422. set moderation($chan,total,old) $moderation($chan,total)
  423. }
  424. }
  425. }
  426. }
  427. }
  428. }
  429. }
  430.  
  431. proc ajoutermot {hand idx args} {
  432. global bwl
  433. set chan [string tolower [lindex [console $idx] 0]]
  434. if {![validchan $chan]} {putdcc $idx "Console invalide ($chan)"; return 0}
  435. if {![matchattr [idx2hand $idx] o|o $chan]} {putdcc $idx "Acces refusé pour $chan"; return 0}
  436. set word [string tolower [lindex $args 0]]
  437. if {$word == ""} {putdcc $idx ".addword <mot> (ajoute un mot)"; return 0}
  438. if {![info exists bwl($chan)]} {set bwl($chan) ""}
  439. if {[lsearch -exact "x $bwl($chan)" "$word"] == -1} {
  440. lappend bwl($chan) $word
  441. set f [open moderation.$chan.list w]
  442. puts $f "$bwl($chan)"
  443. close $f
  444. putdcc $idx "$word ajouté."
  445. return 1
  446. } else {putdcc $idx "$word est deja dans la liste! (taper .listword pour voir la liste)"; return 0}
  447. }
  448.  
  449. proc effacermot {hand idx args} {
  450. global bwl
  451. set chan [string tolower [lindex [console $idx] 0]]
  452. if {![validchan $chan]} {putdcc $idx "Console invalide ($chan)"; return 0}
  453. if {![matchattr [idx2hand $idx] o|o $chan]} {putdcc $idx "Acces refusé pour $chan"; return 0}
  454. if {![info exists bwl($chan)]} {putdcc $idx "Aucun mot pour $chan"; return 0}
  455. set word [string tolower [lindex $args 0]]
  456. if {$word == ""} {putdcc $idx ".delword <mot> (efface un mot)"; return 0}
  457. if {[lsearch -exact "$bwl($chan)" "$word"] != -1} {
  458. set f [open moderation.$chan.list r]
  459. gets $f tmpl
  460. close $f
  461. set newlist ""
  462. foreach t $tmpl {
  463. if {$t != "$word"} {lappend newlist $t}
  464. }
  465. set f [open moderation.$chan.list w]
  466. puts $f "$newlist"
  467. set bwl($chan) $newlist
  468. close $f
  469. putdcc $idx "$word éffacé."
  470. return 1
  471. } else {putdcc $idx "$word est pas dans la liste! (taper .listword pour voir la liste)"; return 0}
  472. }
  473.  
  474. proc listmot {hand idx args} {
  475. global bwl
  476. set chan [string tolower [lindex [console $idx] 0]]
  477. if {![validchan $chan]} {putdcc $idx "Console invalide ($chan)"; return 0}
  478. if {![matchattr [idx2hand $idx] o|o $chan]} {putdcc $idx "Acces refusé pour $chan"; return 0}
  479. if {![info exists bwl($chan)]} {putdcc $idx "Aucun mot pour $chan"; return 0}
  480. putdcc $idx "Liste des Badwords: $bwl($chan)"
  481. return 1
  482. }
  483.  
  484. proc ajouterchan {hand idx args} {
  485. global bwc bwl
  486. set tchan [string tolower [lindex $args 0]]
  487. if {$tchan == ""} {putdcc $idx ".+modchan <#channel> (ajoute un canal a surveiller)"; return 0}
  488. if {![validchan $tchan]} {putdcc $idx "Channel invalide ($tchan)"; return 0}
  489. if {![matchattr [idx2hand $idx] o|o $tchan]} {putdcc $idx "Acces refusé pour $tchan"; return 0}
  490. if {[lsearch -exact "x $bwc" "$tchan"] == -1} {
  491.  
  492. set f [open moderation.$tchan.list w]
  493. close $f
  494. set bwl($tchan) ""
  495.  
  496. set f [open moderation.chan w]
  497. puts $f [lappend bwc $tchan]
  498. close $f
  499. putdcc $idx "$tchan ajouté."
  500. return 1
  501. } else {putdcc $idx "$tchan est deja dans la liste! (taper .modchan pour voir la liste)";return 0}
  502. }
  503.  
  504. proc effacerchan {hand idx args} {
  505. global bwc
  506. set tchan [string tolower [lindex $args 0]]
  507. if {$tchan == ""} {putdcc $idx ".-modchan <#channel> (efface un canal surveillé)"; return 0}
  508. if {![validchan $tchan]} {putdcc $idx "Channel invalide ($tchan)"; return 0}
  509. if {![matchattr [idx2hand $idx] o|o $tchan]} {putdcc $idx "Acces refusé pour $tchan"; return 0}
  510. if {[lsearch -exact "x $bwc" "$tchan"] != -1} {
  511. set f [open moderation.chan r]
  512. set tmpl [gets $f]
  513. close $f
  514. set newlist ""
  515. foreach t $tmpl {
  516. if {$t != "$tchan"} {lappend newlist $t}
  517. }
  518. set f [open moderation.chan w]
  519. puts $f "$newlist"
  520. close $f
  521. set bwc $newlist
  522. putdcc $idx "$tchan éffacé."
  523. return 1
  524. } else {putdcc $idx "$tchan est pas dans la liste! (taper .modchan pour voir la liste)";return 0}
  525. }
  526.  
  527. proc listchan {hand idx args} {
  528. global bwc
  529. putdcc $idx "Liste des canaux: $bwc"
  530. return 1
  531. }
  532.  
  533. set dir ""
  534. set pubfile "chans.pub"
  535.  
  536. proc dcc_antipub {hand idx arg} {
  537. global dir pubfile
  538. set cmd [lindex $arg 0]
  539. set cmd2 [lindex $arg 1]
  540.  
  541. if {$cmd == "help" } {
  542. putdcc $idx " Cette commande permet d'activer l'antipub sur un chan."
  543. return 0
  544. }
  545.  
  546. if {$cmd == "listchan"} {
  547. putcmdlog "#$hand# antipub listchan"
  548. putidx $idx "Liste des chans où l'antipub est actif:"
  549. if {[file exists ${dir}${pubfile}]} {
  550. set read [open ${dir}${pubfile} r]
  551. while {![eof $read]} {
  552. set data [string tolower [gets $read]]
  553. if {[eof $read]} {break}
  554. if {$data != ""} {
  555. putidx $idx "$data"
  556. }
  557. }
  558. close $read
  559. }
  560. return 0
  561. }
  562.  
  563. if { $cmd == "" } {
  564. putdcc $idx "\002Usage:\002 .antipub #chan on/off ou .antipub listchan, tapez .antipub help pour obtenir de l'aide sur cette commande"
  565. return 0
  566. }
  567.  
  568. if {![validchan $cmd]} {
  569. putdcc $idx "Je ne suis pas sur $cmd.\r"
  570. return 0
  571. }
  572.  
  573. if {![matchattr $hand n|n $cmd]} {
  574. putdcc $idx "Cette commande n'est accessible qu'aux owners globaux ou sur $cmd."
  575. return 0
  576. }
  577.  
  578. if {$cmd2 == "on"} {
  579. putcmdlog "#$hand# antipub $cmd on"
  580. if {[trouvchan $cmd $pubfile]} {
  581. putidx $idx "L'antipub est deja actif sur le chan $cmd !"
  582. return 0
  583. }
  584. set temp [addedchan $cmd $pubfile]
  585. putidx $idx "L'antipub est maintenant actif sur le chan $cmd !"
  586. return 0
  587. }
  588.  
  589. if {$cmd2 == "off"} {
  590. putcmdlog "#$hand# antipub $cmd off"
  591. if {![file exists ${dir}${pubfile}]} {
  592. putidx $idx "Vous devez d'abord utiliser .antipub #chan on !"
  593. return 0
  594. }
  595. if {![trouvchan $cmd $pubfile]} {
  596. putidx $idx "L'antipub sur $cmd n'est pas actif !"
  597. return 0
  598. }
  599. set temp [rmchannel $cmd $pubfile]
  600. putidx $idx "L'antipub sur $cmd n'est plus actif."
  601. return 0
  602. }
  603. }
  604.  
  605. proc chanpub {nick userhost hand chan arg} {
  606. global okipub badpub check_recidive botnick pubfile moderation
  607. if {![trouvchan $chan $pubfile] || ![botisop $chan] } { return 0 }
  608. if {[isop $nick $chan]} { return 0 }
  609. if {[matchattr $hand $moderation(flagexept) $chan]} { return 0 }
  610. if {[string match *$chan* $arg]} { return 0 }
  611. set hostban [lindex [split $userhost @] 1]
  612.  
  613. foreach okip $moderation(puboklist) {
  614. if {[string match *$okip* $arg]} {
  615. return 0
  616. }
  617. }
  618. foreach badp $moderation(pubnolist) {
  619. if {[string match *$badp* $arg]} {
  620. if {[info exists moderation($userhost)]} {
  621. if {$moderation($userhost)>=1} {
  622.  
  623. if {[unixtime]>[expr $moderation($userhost.TIME)+$moderation(pubtime)]} {
  624. putserv "NOTICE $nick :4Attention! Evitez vos Publicités! La prochaine fois vous serez Expulsé!"
  625. set moderation($userhost) 1
  626. set moderation($userhost.TIME) [unixtime]
  627. return 0
  628. }
  629. if {$moderation(pubban)=="1"} { newchanban $chan *!*@$hostban moderation "$moderation(pubkickraison)" $moderation(pubbantime) }
  630. if {$moderation(pubkick)=="1"} { putserv "KICK $chan $nick :$moderation(pubkickraison)" }
  631. unset moderation($userhost)
  632. unset moderation($userhost.TIME)
  633. return 0
  634.  
  635. } else {
  636. if {$moderation(pubaverto)=="1"} {
  637. putserv "NOTICE $nick : $moderation(pubavertomsg)"
  638. }
  639. incr moderation($userhost)
  640. set moderation($userhost.TIME) [unixtime]
  641. return 0
  642. }
  643. } else {
  644. if {$moderation(pubaverto)=="1"} {
  645. putserv "NOTICE $nick : $moderation(pubavertomsg)"
  646. }
  647. set moderation($userhost) 1
  648. set moderation($userhost.TIME) [unixtime]
  649. return 0
  650. }
  651. }
  652. }
  653. return 0
  654. }
  655.  
  656. proc addedchan {channel typefile} {
  657. global privfile dir pubfile
  658. set chan [string tolower $channel]
  659. if {![file exists ${dir}${typefile}]} {
  660. set create [open ${dir}${typefile} w]
  661. puts $create $chan
  662. close $create
  663. return 0
  664. }
  665. if {[file exists ${dir}${typefile}]} {
  666. set addfile [open ${dir}${typefile} a]
  667. puts $addfile $chan
  668. close $addfile
  669. return 0
  670. }
  671. return 0
  672. }
  673.  
  674. proc trouvchan {channel typefile} {
  675. global privfile dir pubfile
  676. set chan [string tolower $channel]
  677. if {[file exists ${dir}${typefile}]} {
  678. set read [open ${dir}${typefile} r]
  679. while {![eof $read]} {
  680. set data [string tolower [gets $read]]
  681. if {[eof $read]} {break}
  682. if {$chan == $data && $data != ""} {
  683. close $read
  684. return 1
  685. }
  686. }
  687. close $read
  688. }
  689. return 0
  690. }
  691.  
  692. proc rmchannel {channel typefile} {
  693. global privfile dir pubfile
  694. set chan [string tolower $channel]
  695. if {![file exists ${dir}${typefile}]} {
  696. return 0
  697. }
  698. if {[file exists ${dir}${typefile}]} {
  699. set read [open ${dir}${typefile} r]
  700. while {![eof $read]} {
  701. set data [string tolower [gets $read]]
  702. if {[eof $read]} {break}
  703. if {$chan != $data && $data !=""} {
  704. set addfile [open ${dir}${typefile}.new a]
  705. puts $addfile $data
  706. close $addfile
  707. }
  708. }
  709. close $read
  710. if {![file exists ${dir}${typefile}.new]} {
  711. set addfile [open ${dir}${typefile}.new a]
  712. puts $addfile ""
  713. close $addfile
  714. }
  715. set removefile [file delete -force ${dir}${typefile}]
  716. set copynew [file copy -force ${dir}${typefile}.new ${dir}${typefile}]
  717. set removeold [file delete -force ${dir}${typefile}.new]
  718. }
  719. return 0
  720. }
  721.  
  722.  
  723. bind msg - help msg:help
  724. proc msg:help {nick uhost handle arg} {
  725. global botnick
  726. putserv "PRIVMSG $nick /MSG commands for $botnick :"
  727. putserv "PRIVMSG $nick OP VOICE KICK INVITE INFO PASS"
  728. putserv "PRIVMSG $nick Se oper : /msg $botnick op <PASS> <SALON>"
  729. putserv "PRIVMSG $nick Se voicer : /msg $botnick voice <PASS> <SALON>"
  730. putserv "PRIVMSG $nick S'inviter : /msg $botnick invite <PASS> <SALON>"
  731. putserv "PRIVMSG $nick Kicker quelqu'un : /msg $botnick kick <SALON> <PSEUDO> <RAISON>"
  732. putserv "PRIVMSG $nick Mettre une info : /msg $botnick info #soho <INFOLINE>"
  733. putserv "PRIVMSG $nick Changer son password : /msg $botnick PASS <PASSWORD> <NEW_PASSWORD>"
  734. }
  735. bind msg - kick msg:kick
  736. proc msg:kick {nick uhost chan arg} {
  737. set chan [lindex $arg 0]
  738. if [isop $nick $chan] {
  739. putserv "kick [lindex $arg 0] [lindex $arg 1] :[lrange $arg 2 end]"
  740. }
  741. }
  742. bind dcc m xkill xkill:dcc
  743. proc xkill:dcc {nick idx arg} {
  744. putserv "KILL [lindex $arg 0] :[lrange $arg 1 end]"
  745. }
  746. bind dcc m xmode xmode:dcc
  747. proc xmode:dcc {hand idx arg} {
  748. putspeed "MODE [lindex $arg 0] [lrange $arg 1 end]"
  749. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement