View previous topic :: View next topic |
Author |
Message |
r6gear Voice
Joined: 23 Nov 2022 Posts: 3
|
Posted: Wed Nov 23, 2022 9:31 am Post subject: adding flood protections to this |
|
|
i want to add flood protection to this script. if a user want can user !love !love ...etc and floods the channel.
Can anyoane help me adding ? thank you
bind pub - !love fun_give-love
proc fun_give-love {nick uhost hand chan text} {
putserv "privmsg $chan :\001ACTION Lui 5$nick gives 5$text love!))"
} |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1027
|
Posted: Wed Nov 23, 2022 4:15 pm Post subject: |
|
|
Code: |
# throttle time in seconds
set Xthrottled(time) 10
proc throttlecheckerX {chan} {
global Xthrottled
if {[info exists Xthrottled($chan)]} {
return 1
} else {
set Xthrottled($chan) [utimer $::Xthrottled(time) [list unset Xthrottled($chan)]]
return 0
}
}
bind pub - !love fun_give-love
proc fun_give-love {nick uhost hand chan text} {
if {[throttlecheckerX $chan]} { return 0 }
set text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]
set items [split $text]
if {[llength $items] < 1 } { putnow "notice $nick :Syntax\: !love nick" ; return }
set lovenick [lindex [split $text] 0]
putserv "privmsg $chan :\001ACTION \002\00305,00 $nick \002\00312 gives \00306\002 $lovenick \002\00307 love \003\017"
}
|
Last edited by simo on Thu Nov 24, 2022 8:53 am; edited 2 times in total |
|
Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1108 Location: France
|
Posted: Wed Nov 23, 2022 7:01 pm Post subject: |
|
|
@simo : so the command could only be used once every 10s on the chan, whoever use it ?
Why throttlecheckerX has nick as argument if it's not used ? _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
Back to top |
|
 |
r6gear Voice
Joined: 23 Nov 2022 Posts: 3
|
Posted: Wed Nov 23, 2022 7:25 pm Post subject: |
|
|
simo wrote: | Code: |
# throttle time in seconds
set Xthrottled(time) 10
proc throttlecheckerX {nick chan} {
global Xthrottled
if {[info exists Xthrottled($chan)]} {
return 1
} else {
set Xthrottled($chan) [utimer $::Xthrottled(time) [list unset Xthrottled($chan)]]
return 0
}
}
bind pub - !love fun_give-love
proc fun_give-love {nick uhost hand chan text} {
if {[throttlecheckerX $nick $chan]} { return 0 }
set text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]
set items [split $text]
if {[llength $items] < 1 } { putnow "notice $nick :Syntax\: !love nick" ; return }
set lovenick [lindex [split $text] 0]
putserv "privmsg $chan :\001ACTION \002\00305,00 $nick \002\00312 gives \00306\002 $lovenick \002\00307 love \003\017"
}
|
|
Thank you for helping! !beer |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1027
|
Posted: Thu Nov 24, 2022 12:26 am Post subject: |
|
|
That's true i overlooked that thanks for pointing out CrazyCat 👍 |
|
Back to top |
|
 |
r6gear Voice
Joined: 23 Nov 2022 Posts: 3
|
Posted: Thu Nov 24, 2022 10:14 am Post subject: |
|
|
it's posibile to add a option every user to have let's say 1 shoot every 30 seconds? |
|
Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1108 Location: France
|
Posted: Thu Nov 24, 2022 11:45 am Post subject: |
|
|
Just add the nick in the key of Xthrottled. That is what I pointed previously.
Code: | # throttle time in seconds
set Xthrottled(time) 10
proc throttlecheckerX {nick chan} {
global Xthrottled
if {[info exists Xthrottled($chan,$nick)]} {
return 1
} else {
set Xthrottled($chan,$nick) [utimer $::Xthrottled(time) [list unset Xthrottled($chan,$nick)]]
return 0
}
}
bind pub - !love fun_give-love
proc fun_give-love {nick uhost hand chan text} {
if {[throttlecheckerX $nick $chan]} { return 0 }
set text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]
set items [split $text]
if {[llength $items] < 1 } { putnow "notice $nick :Syntax\: !love nick" ; return }
set lovenick [lindex [split $text] 0]
putserv "privmsg $chan :\001ACTION \002\00305,00 $nick \002\00312 gives \00306\002 $lovenick \002\00307 love \003\017"
} |
_________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
Back to top |
|
 |
|