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.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
mvp1
Voice
Posts: 22 Joined: Thu Jan 27, 2022 4:28 am
Post
by mvp1 » Thu Aug 11, 2022 3:59 am
Hi folks,
I am using below code for join/part (revolving door). It is working fine, but when multiple nicks join/part, the script also sets the channel mode command multiple times.
Appreciate if anyone can help modify the code in a loop or may be any possible check, so the channel modelock happens only once? May be check the existing channel modes before running a modelock again? Or check existing channel modes every time before running a modelock? Or any other solution that doesn't involve too much lag on the bot. (I still want the bans for each of the join/part nicks)
Thanks in advance.
Code: Select all
set jp(part) 3
set jp(lock_modes) "R"
setudef flag joinpart
bind part - * ban:jp
proc ban:jp {nick uhost hand chan arg} {
global jp botnick jpchan kickcount logo
if {[isbotnick $nick] || ![botisop $chan] || ![channel get $chan joinpart]} {
return
}
if {![info exists jpchan($chan)]} {
set jpchan($chan) 0
}
if {($chan == $botnick) || [matchattr $hand b] || [matchattr $hand fom|fom $chan]} {
return
}
if {[getchanjoin $nick $chan] >= [expr {[clock seconds]-$jp(part)}]} {
if {$jp(style) == "1"} {
set banmask [jp:banmask $uhost $nick]
putquick "MODE $chan +$jp(lock_modes)b $banmask"
putserv "KICK $chan $nick :$jp(reason) $kickcount $logo"
putlog "JoinPart: Flood Attempt on $chan ($banmask) banned on the channel"
timer $jp(unlock) [list putquick "MODE $chan -$jp(lock_modes)"]
}
if {$jp(style) == "2"} {
set banmask [jp:banmask $uhost $nick]
putquick "MODE $chan +$jp(lock_modes)b $banmask"
putserv "KICK $chan $nick :$jp(reason) $kickcount $logo"
putlog "JoinPart: Flood Attempt on $chan ($banmask) added in the channel banlist"
newchanban "$chan" "$banmask" "JoinPart" "$jp(reason)" "$jp(btime)"
timer $jp(unlock) [list putquick "MODE $chan -$jp(lock_modes)"]
}
if {$jp(style) == "3"} {
set banmask [jp:banmask $uhost $nick]
putquick "MODE $chan +$jp(lock_modes)b $banmask"
putserv "KICK $chan $nick :$jp(reason) $kickcount $logo"
putlog "JoinPart: Flood Attempt on $chan ($banmask) added in the global banlist"
newban "$banmask" "JoinPart" "$jp(reason)" "$jp(btime)"
timer $jp(unlock) [list putquick "MODE $chan -$jp(lock_modes)"]
}
}
}
proc jp:banmask {uhost nick} {
global jpban_type
switch -- $jpban_type {
1 { set banmask "*!*@[lindex [split $uhost @] 1]" }
2 { set banmask "*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
3 { set banmask "*!*$uhost" }
4 { set banmask "*!*[lindex [split [maskhost $uhost] "!"] 1]" }
5 { set banmask "*!*[lindex [split $uhost "@"] 0]*@[lindex [split $uhost "@"] 1]" }
6 { set banmask "*$nick*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
7 { set banmask "*$nick*!*@[lindex [split $uhost "@"] 1]" }
8 { set banmask "$nick![lindex [split $uhost "@"] 0]@[lindex [split $uhost @] 1]" }
9 { set banmask "$nick![lindex [split $uhost "@"] 0]@[lindex [split [maskhost $uhost] "@"] 1]" }
default { set banmask "*!*@[lindex [split $uhost @] 1]" }
return $banmask
}
}
mvp1
Voice
Posts: 22 Joined: Thu Jan 27, 2022 4:28 am
Post
by mvp1 » Thu Aug 11, 2022 10:14 pm
I have made below changes to above to check for +R modelock check, but the mode check check seems to be too slow when 2-3 nicks do revolving/join-part at the same time and the bot still does the modelocks multiple times.
Any solutions, suggestions please?
Modified Code:
Code: Select all
if {[getchanjoin $nick $chan] >= [expr {[clock seconds]-$jp(part)}]} {
if {$jp(style) == "1"} {
set banmask [jp:banmask $uhost $nick]
if {![string match *R* [lindex [getchanmode $chan] 0]]} {
putquick "MODE $chan +$jp(lock_modes)b $banmask"
timer $jp(unlock) [list putquick "MODE $chan -$jp(lock_modes)"]
}
putquick "MODE $chan +b $banmask"
putserv "KICK $chan $nick :$jp(reason) $kickcount $logo"
putlog "JoinPart: Flood Attempt on $chan ($banmask) banned on the channel"
# timer $jp(unlock) [list putquick "MODE $chan -$jp(lock_modes)"]
}
Below is the example even after above modified code.
Code: Select all
→ NOONECANSTOPME_}_ joined (~ipr@4ea-8986-f438-9e7b-dce3.83.170.ip)
5:04 AM ← NOooo_}_ left (~ipr@4ea-8986-f438-9e7b-dce3.83.170.ip)
5:04 AM → NOONooo_ joined (~ipr@4ea-8986-f438-9e7b-dce3.83.170.ip)
5:04 AM → noooodsdooo joined (~ybcb@a5e3-836e-d488-e7b3-1c66.111.192.ip)
5:04 AM ← nooooasdjdsad left (~ybcb@a5e3-836e-d488-e7b3-1c66.111.192.ip)
5:04 AM → asdsadsadsa joined (~ybcb@a5e3-836e-d488-e7b3-1c66.111.192.ip)
5:04 AM ← dasdsadsadsa left (~ybcb@a5e3-836e-d488-e7b3-1c66.111.192.ip)
5:04 AM •Bot banned *!*@4ea-8986-f438-9e7b-dce3.83.170.ip (+b)
5:04 AM Channel mode set to +R by •Bot
5:04 AM •Bot banned *!*@a5e3-836e-d488-e7b3-1c66.111.192.ip (+b)
5:04 AM Channel mode set to +R by •Bot
5:04 AM ← Nooonasdndsadn_ left (~ipr@4ea-8986-f438-9e7b-dce3.83.170.ip)
simo
Revered One
Posts: 1100 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Fri Aug 12, 2022 4:59 pm
try this :
Code: Select all
set jp(part) 3
set jp(lock_modes) "R"
setudef flag joinpart
bind part - * ban:jp
proc ban:jp {nick uhost hand chan arg} {
global jp botnick jpchan kickcount logo
if {[isbotnick $nick] || ![botisop $chan] || ![channel get $chan joinpart]} {
return
}
if {![info exists jpchan($chan)]} {
set jpchan($chan) 0
}
if {[matchattr $hand b] || [matchattr $hand fom|fom $chan]} {
return
}
if {[getchanjoin $nick $chan] >= [expr {[clock seconds]-$jp(part)}]} {
if {$jp(style) == "1"} {
set banmask [jp:banmask $uhost $nick]
jp:lockchan $chan
pushmode $chan +b $banmask
putserv "KICK $chan $nick :$jp(reason) $kickcount $logo"
putlog "JoinPart: Flood Attempt on $chan ($banmask) banned on the channel"
}
if {$jp(style) == "2"} {
set banmask [jp:banmask $uhost $nick]
jp:lockchan $chan
pushmode $chan +b $banmask
putserv "KICK $chan $nick :$jp(reason) $kickcount $logo"
putlog "JoinPart: Flood Attempt on $chan ($banmask) added in the channel banlist"
newchanban "$chan" "$banmask" "JoinPart" "$jp(reason)" "$jp(btime)"
}
if {$jp(style) == "3"} {
set banmask [jp:banmask $uhost $nick]
jp:lockchan $chan
pushmode $chan +b $banmask
putserv "KICK $chan $nick :$jp(reason) $kickcount $logo"
putlog "JoinPart: Flood Attempt on $chan ($banmask) added in the global banlist"
newban "$banmask" "JoinPart" "$jp(reason)" "$jp(btime)"
}
flushmode $chan
}
}
proc jp:banmask {uhost nick} {
global jpban_type
switch -- $jpban_type {
1 { set banmask "*!*@[lindex [split $uhost @] 1]" }
2 { set banmask "*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
3 { set banmask "*!*$uhost" }
4 { set banmask "*!*[lindex [split [maskhost $uhost] "!"] 1]" }
5 { set banmask "*!*[lindex [split $uhost "@"] 0]*@[lindex [split $uhost "@"] 1]" }
6 { set banmask "*$nick*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
7 { set banmask "*$nick*!*@[lindex [split $uhost "@"] 1]" }
8 { set banmask "$nick![lindex [split $uhost "@"] 0]@[lindex [split $uhost @] 1]" }
9 { set banmask "$nick![lindex [split $uhost "@"] 0]@[lindex [split [maskhost $uhost] "@"] 1]" }
default { set banmask "*!*@[lindex [split $uhost @] 1]" }
return $banmask
}
}
proc jp:lockchan {chan} {
global lock_channel jp
if {![info exists lock_channel($chan)]} {
putnow "mode $chan +$jp(lock_modes)"
timer $jp(unlock) [list putquick "MODE $chan -$jp(lock_modes)"]
set lock_channel($chan) 1
utimer 10 [list unset -nocomplain ::lock_channel($chan)]
}
}
Last edited by
simo on Mon Aug 15, 2022 9:33 pm, edited 1 time in total.
simo
Revered One
Posts: 1100 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Fri Aug 12, 2022 5:12 pm
on wich network / ircd version are u running this ?
simo
Revered One
Posts: 1100 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Fri Aug 12, 2022 5:36 pm
you might want to set channel mode like +j 2:2 that helps as well
Last edited by
simo on Thu Sep 01, 2022 6:45 am, edited 4 times in total.
mvp1
Voice
Posts: 22 Joined: Thu Jan 27, 2022 4:28 am
Post
by mvp1 » Sat Aug 13, 2022 4:51 am
Hi Simo,
On DALnet mate, eggdrop 1.8.3
simo wrote: on wich network / ircd version are u running this ?
mvp1
Voice
Posts: 22 Joined: Thu Jan 27, 2022 4:28 am
Post
by mvp1 » Sat Aug 13, 2022 4:53 am
Thanks Simo, I'm testing this. Seems to be working in principle, but will have to see how quick it reacts during flood and does the job.
Thanks again mate