| View previous topic :: View next topic |
| Author |
Message |
geek Voice
Joined: 24 Oct 2008 Posts: 37
|
Posted: Sat Apr 24, 2021 3:42 am Post subject: about bind flud |
|
|
I read the documentation about this kind of bind
I have two questions:
1) "if the proc returns 0, the bot will do its normal punishment for the flood"
what is the normal punishment? ban+kick maybe?
2) I would like add an additional behavior to normal punishment, I want set the channel +i
how can I write this tcl?
I think something like:
| Code: |
bind flud - join mytest
proc mytest {nick uhost hand type chan} {
if {![botisop $chan] || [matchattr $hand "of|of" $chan]} { return 0 }
#set banmask "*!*@[lindex [split $uhost @] 1]"
#newchanban $chan $banmask $botnick flood
#putquick "KICK $chan $nick flood"
putquick "MODE $chan +i"
utimer 90 [list putquick "MODE $chan -i"]
return 0
} |
it's correct?
and with this code the channel is set +i every time for every bad user in flood? or only once?
and if I want to overwrite eggdrop default behavior, can I uncomment ban and kick line, and set return 1? right? |
|
| Back to top |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 393
|
Posted: Sat Apr 24, 2021 3:56 am Post subject: |
|
|
Yeah, you need return 1 to prevent the "normal punishments"
Read more on bind flud here
https://docs.eggheads.org/mainDocs/tcl-commands.html
| Code: |
bind FLUD - join jo:in
proc jo:in {nick host hand type chan} {
if {![botisop $chan] || [matchattr $hand ofmn|ofmn]} {return}
set banmask "*!*@[lindex [split $host @] 1]"
newchanban $chan $banmask $::botnick flood
putquick "KICK $chan $nick flood"
putquick "MODE $chan +i"
utimer 90 [list putquick "MODE $chan -i"]
return 1
}
|
_________________ ComputerTech |
|
| Back to top |
|
 |
geek Voice
Joined: 24 Oct 2008 Posts: 37
|
Posted: Sat Apr 24, 2021 7:18 am Post subject: |
|
|
| thanks @ComputerTech |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sat Apr 24, 2021 8:37 am Post subject: Re: about bind flud |
|
|
| geek wrote: |
...
what is the normal punishment?
...
|
I think it is kick only.
As to whether even that is on or off - and if on, the config - do:
.chaninfo #channel
in the partyline and see the flood settings at the bottom of the info returned. _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
geek Voice
Joined: 24 Oct 2008 Posts: 37
|
Posted: Sat Apr 24, 2021 11:33 am Post subject: |
|
|
I write this:
| Code: |
set joinlockmodes "i"
# eggdrop will unlock the channel after the specified time in seconds you will set below
set unlocktime "60"
# set the reason you want
set jreason "test test"
bind flud - join joinflood:mytest
proc joinflood:mytest {nick uhost hand type chan {islock 0}} {
global joinlockmodes unlocktime jreason botnick
if {![botisop $chan] || [matchattr $hand "of|of" $chan]} { return 0 }
if { $islock < 1 } {
putquick "MODE $chan +$joinlockmodes"
set islock 1
}
set banmask "*!*@[lindex [split $uhost @] 1]"
# set banmask "*!*@[lindex [split [maskhost $uhost] "@"] 1]"
putquick "MODE $chan +b $banmask"
# putquick "KICK $chan $nick $jreason"
utimer $unlocktime {
unset islock
if {[string match *i* [lindex [split [getchanmode $chan]] 0]]} {
[list putquick "MODE $chan -$joinlockmodes"]
}
}
return 1
} |
lock works fine but I got two errors when it try to execute utimer:
1) Tcl error in script for 'timer': can't unset "islock": no such variable
2) Tcl error in script for 'timer': can't read "chan": no such variable
how can i fix it? |
|
| Back to top |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 393
|
Posted: Sat Apr 24, 2021 12:04 pm Post subject: |
|
|
Try this
| Code: |
set joinlockmodes "i"
# eggdrop will unlock the channel after the specified time in seconds you will set below
set unlocktime "60"
# set the reason you want
set jreason "test test"
bind flud - join joinflood:mytest
proc joinflood:mytest {nick uhost hand type chan} {
global joinlockmodes unlocktime jreason botnick
if {![botisop $chan] || [matchattr $hand "of|of" $chan]} { return 0 }
set islock 1
if { $islock < 1 } {
putquick "MODE $chan +$joinlockmodes"
}
set banmask "*!*@[lindex [split $uhost @] 1]"
# set banmask "*!*@[lindex [split [maskhost $uhost] "@"] 1]"
putquick "MODE $chan +b $banmask"
# putquick "KICK $chan $nick $jreason"
utimer $unlocktime {
unset islock
if {[string match *i* [lindex [split [getchanmode $chan]] 0]]} {
putquick "MODE $chan -$joinlockmodes"
}
}
return 1
}
|
_________________ ComputerTech |
|
| Back to top |
|
 |
geek Voice
Joined: 24 Oct 2008 Posts: 37
|
Posted: Sat Apr 24, 2021 12:40 pm Post subject: |
|
|
| ComputerTech wrote: | Try this
| Code: |
...
set islock 1
if { $islock < 1 } {
... |
|
this can't work :) |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Sat Apr 24, 2021 12:59 pm Post subject: |
|
|
You'd better not unset islock and have it global:
| Code: | set joinlockmodes "i"
# eggdrop will unlock the channel after the specified time in seconds you will set below
set unlocktime "60"
# set the reason you want
set jreason "test test"
set islock 0
bind flud - join joinflood:mytest
proc joinflood:mytest {nick uhost hand type chan} {
global joinlockmodes unlocktime jreason botnick islock
if {![botisop $chan] || [matchattr $hand "of|of" $chan]} { return 0 }
if { $islock < 1 } {
putquick "MODE $chan +$joinlockmodes"
set islock 1
}
set banmask "*!*@[lindex [split $uhost @] 1]"
# set banmask "*!*@[lindex [split [maskhost $uhost] "@"] 1]"
putquick "MODE $chan +b $banmask"
# putquick "KICK $chan $nick $jreason"
utimer $unlocktime {
set islock 0
if {[string match *i* [lindex [split [getchanmode $chan]] 0]]} {
[list putquick "MODE $chan -$joinlockmodes"]
}
}
return 1
} |
_________________ 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 |
|
 |
geek Voice
Joined: 24 Oct 2008 Posts: 37
|
Posted: Sat Apr 24, 2021 1:20 pm Post subject: |
|
|
thanks CrazyCat
your code resolve error 1) but still have error 2) can't read "chan": no such variable
edit:
it's VERY VERY strange
if I use: | Code: |
utimer $unlocktime { set islock 0 }
utimer $unlocktime [list putquick "MODE $chan -$joinlockmodes"] |
works! |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Sat Apr 24, 2021 6:05 pm Post subject: |
|
|
It's normal. You create an anonymous procedure, so variables from the main proc which are not global are unknown from it.
You'd better create a proc "unlock" and call it from utimer whith the relevant arguments ($chan) to get ride of this trouble _________________ 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 |
|
 |
geek Voice
Joined: 24 Oct 2008 Posts: 37
|
Posted: Sun Apr 25, 2021 3:15 am Post subject: |
|
|
ok, thanks CrazyCat
I read this thread
very well explained |
|
| Back to top |
|
 |
|