This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

about bind flud

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
g
geek
Halfop
Posts: 47
Joined: Fri Oct 24, 2008 6:07 am

about bind flud

Post by geek »

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: Select all

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?
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

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: Select all

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
g
geek
Halfop
Posts: 47
Joined: Fri Oct 24, 2008 6:07 am

Post by geek »

thanks @ComputerTech
w
willyw
Revered One
Posts: 1196
Joined: Thu Jan 15, 2009 12:55 am

Re: about bind flud

Post by willyw »

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 !
g
geek
Halfop
Posts: 47
Joined: Fri Oct 24, 2008 6:07 am

Post by geek »

I write this:

Code: Select all

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?
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

Try this

Code: Select all

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
g
geek
Halfop
Posts: 47
Joined: Fri Oct 24, 2008 6:07 am

Post by geek »

ComputerTech wrote:Try this

Code: Select all

...
    set islock 1
    if { $islock < 1 } {
...
this can't work :)
User avatar
CrazyCat
Revered One
Posts: 1217
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

You'd better not unset islock and have it global:

Code: Select all

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
}
g
geek
Halfop
Posts: 47
Joined: Fri Oct 24, 2008 6:07 am

Post by geek »

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: Select all

 utimer $unlocktime { set islock 0 }
 utimer $unlocktime [list putquick "MODE $chan -$joinlockmodes"]

works!
User avatar
CrazyCat
Revered One
Posts: 1217
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

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
g
geek
Halfop
Posts: 47
Joined: Fri Oct 24, 2008 6:07 am

Post by geek »

ok, thanks CrazyCat


I read this thread

very well explained
Post Reply