Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 KB | None | 0 0
  1. # Anti flood sur les commandes du Bot x:y (x=nombre de fois, y=secondes) :
  2. set octopopo(flood) 3:15
  3.  
  4. # Ignorer l'utilisateur après son flood (0=non, 1=oui) :
  5. set octopopo(ignore) 1
  6.  
  7. # Si oui, combien de temps (en minutes) :
  8. set octopopo(ignoretime) 3
  9.  
  10. # Laisser faire les utilisateurs ayant certains flags :
  11. set octopopo(ignflags) "fmnov|fmnov"
  12.  
  13. # Préfixe des commandes du script :
  14. set octopopo(command) "!"
  15.  
  16. # Channels où les commandes seront effectives :
  17. set octopopo(chans) "*"
  18.  
  19. #####################################################################
  20. proc octopopo:flood:init {} {
  21. global octopopo octopopoflood
  22. set octopopo(floodnum) [lindex [split $octopopo(flood) :] 0]
  23. set octopopo(floodtime) [lindex [split $octopopo(flood) :] 1]
  24. set i [expr $octopopo(floodnum) - 1]
  25. while {$i >= 0} {
  26. set octopopoflood($i) 0
  27. incr i -1
  28. }
  29. }
  30. octopopo:flood:init
  31.  
  32. proc octopopo:flood {nick uhost} {
  33. global octopopo octopopoflood botnick
  34. if {$octopopo(floodnum) == 0} {
  35. return 0
  36. }
  37. set i [expr $octopopo(floodnum) - 1]
  38. while {$i >= 1} {
  39. set octopopoflood($i) $octopopoflood([expr $i - 1])
  40. incr i -1
  41. }
  42. set octopopoflood(0) [unixtime]
  43. if {[expr [unixtime] - $octopopoflood([expr $octopopo(floodnum) - 1])] <= $octopopo(floodtime)} {
  44. if {$octopopo(ignore)} {
  45. newignore [join [maskhost *!*[string trimleft $uhost ~]]] $botnick "Flood" $octopopo(ignoretime)
  46. }
  47. return 1
  48. } {
  49. return 0
  50. }
  51. }
  52.  
  53. ##########
  54.  
  55. bind pub -|- $octopopo(command)cerveau octopopo:cerveau
  56. proc octopopo:cerveau {nick uhost hand channel arg} {
  57. global botnick octopopo
  58. if ![matchattr $nick $octopopo(ignflags) $channel] {
  59. if {[octopopo:flood $nick $uhost]} {
  60. return 0
  61. }
  62. }
  63. if {(([lsearch -exact [string tolower $octopopo(chans)] [string tolower $channel]] != -1) || ($octopopo(chans) == "*")) && (![matchattr $hand b]) && ($nick != $botnick)} {
  64. if ![string length $arg] {
  65. puthelp "PRIVMSG $channel :$nick s'offre un Cerveau :)"
  66. return 1
  67. } elseif {[string tolower $arg] == [string tolower $botnick]} {
  68. puthelp "PRIVMSG $channel : Non merci $nick , suis programmé moi :)"
  69. return 1
  70. } elseif {[string tolower $arg] == [string tolower $nick]} {
  71. puthelp "PRIVMSG $channel : $nick s'offre un Cerveau :)"
  72. return 1
  73. } else {
  74. puthelp "PRIVMSG $channel : PLOP!!! Un nouveau Cerveau Tout Neuf $arg ...Merci $nick mais c'est pas sur que cela lui serve!"
  75. return 1
  76. }
  77. }
  78. }
  79.  
  80. putlog "octopopo v1.1 by ShadOw loaded!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement