egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

about bind flud

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
geek
Voice


Joined: 24 Oct 2008
Posts: 37

PostPosted: Sat Apr 24, 2021 3:42 am    Post subject: about bind flud Reply with quote

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
View user's profile Send private message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Sat Apr 24, 2021 3:56 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
geek
Voice


Joined: 24 Oct 2008
Posts: 37

PostPosted: Sat Apr 24, 2021 7:18 am    Post subject: Reply with quote

thanks @ComputerTech
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1169

PostPosted: Sat Apr 24, 2021 8:37 am    Post subject: Re: about bind flud Reply with quote

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
View user's profile Send private message
geek
Voice


Joined: 24 Oct 2008
Posts: 37

PostPosted: Sat Apr 24, 2021 11:33 am    Post subject: Reply with quote

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
View user's profile Send private message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Sat Apr 24, 2021 12:04 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
geek
Voice


Joined: 24 Oct 2008
Posts: 37

PostPosted: Sat Apr 24, 2021 12:40 pm    Post subject: Reply with quote

ComputerTech wrote:
Try this
Code:

...
    set islock 1
    if { $islock < 1 } {
...


this can't work :)
Back to top
View user's profile Send private message
CrazyCat
Owner


Joined: 13 Jan 2002
Posts: 972
Location: France

PostPosted: Sat Apr 24, 2021 12:59 pm    Post subject: Reply with quote

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
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
geek
Voice


Joined: 24 Oct 2008
Posts: 37

PostPosted: Sat Apr 24, 2021 1:20 pm    Post subject: Reply with quote

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
View user's profile Send private message
CrazyCat
Owner


Joined: 13 Jan 2002
Posts: 972
Location: France

PostPosted: Sat Apr 24, 2021 6:05 pm    Post subject: Reply with quote

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
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
geek
Voice


Joined: 24 Oct 2008
Posts: 37

PostPosted: Sun Apr 25, 2021 3:15 am    Post subject: Reply with quote

ok, thanks CrazyCat


I read this thread

very well explained
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber