| View previous topic :: View next topic |
| Author |
Message |
BrewMaster Voice
Joined: 07 Jul 2007 Posts: 34
|
Posted: Tue Jul 10, 2007 12:41 am Post subject: script to clear channel banlist when full |
|
|
I am looking for a script that will clear the channel banlist before it is full.
I tried banlistcleaner.tcl that is onsite but it only seams to adjust the channel banlist when the bot first enters a room. When channel banlist fills up again it dont flush it.
Idealy, the script would remove X number of bans when the channel banlist reached X number of bans in it. Preventing a channel banlist from reaching the maximum channel banlist.
any help would be appreciated.
brew |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Tue Jul 10, 2007 1:20 am Post subject: |
|
|
eggdrop.conf:
| Quote: | #
# dynamicbans
# Only activate bans on the channel when necessary? This keeps
# the channel's ban list from getting excessively long. The bot
# still remembers every ban, but it only activates a ban on the
# channel when it sees someone join who matches that ban.
#
....
# Set here the maximum number of bans you want the bot to set on a channel.
# Eggdrop will not place any more bans if this limit is reached. Undernet
# currently allows 45 bans, IRCnet allows 30, EFnet allows 100, and DALnet
# allows 100.
set max-bans 30
|
_________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
awyeah Revered One

Joined: 26 Apr 2004 Posts: 1580 Location: Switzerland
|
Posted: Tue Jul 10, 2007 8:32 am Post subject: |
|
|
This is actually the old banlist cleaner. I edited this script recently to be free from of all kinds of bugs and errors and added new functions, like "ALL" to remove all channel bans. Here you go, it should work fine!
| Code: |
bind join - "*" banlist:clean:on:join
bind mode - "*" banlist:clean:on:mode
#Remove bans if they go over this number
set banlistmax "100"
#Set the type/order in which you would like to remove the channel bans.
#USAGE: [1/2/3] (1=RANDOM BANS, 2=RECENT PLACED BANS, 3=LAST PLACED BANS)
#Use '1' If you want to remove bans 'randomly' from the channel's banlist.
#Use '2' If you want to remove 'recent placed bans' (increasing banlist) from the channel's banlist.
#Use '3' If you want to remove 'last placed bans' (decreasing banlist) from the channel's banlist.
#Use '4' If you want to remove all bans placed by the bot from the channel's banlist.
set banlisttype "3"
#No of bans to remove 'ALL' or 'any number: 10, 50, 125'
set banlistremove "30"
#Minutes after bot join to check the channel for bans
set banlistdelaycheck "5"
proc banlist:clean:on:join {nick uhost hand chan} {
global banlistdelaycheck
if {[isbotnick $nick]} {
timer $banlistdelaycheck [list banlist:clean:on:mode $nick $uhost $hand $chan "+b" "on:join"]
}
}
proc banlist:clean:on:mode {nick uhost hand chan mode target} {
global botnick banlistmax banlisttype banlistremove
if {[string is integer $banlistremove] && ($banlistremove > $banlistmax)} { return 0 }
if {[string equal "+b" $mode] && [botisop $chan]} {
if {[llength [chanbans $chan]] >= $banlistmax} {
if {$banlisttype == "1"} {
set banlist [chanbans $chan]
} elseif {$banlisttype == "2"} {
set banlist [lsort -index 2 -integer -increasing [chanbans $chan]]
} elseif {$banlisttype == "3"} {
set banlist [lsort -index 2 -integer -decreasing [chanbans $chan]]
} elseif {$banlisttype == "4"} {
set banlist [list]
foreach ban [chanbans $chan] {
if {[string equal -nocase "[lindex [split [lindex $ban 1] !] 0]" $botnick]} {
lappend banlist $ban
}
}
}
if {[string is integer $banlistremove]} {
set removebans [lrange $banlist 0 [expr $banlistremove - 1]]
putserv "ONOTICE $chan :Channel banlist currently has $banlistmax entries. Removing the last $banlistremove bans placed."
foreach ban $removebans {
pushmode $chan -b [lindex $ban 0]
}
flushmode $chan
return 0
} elseif {[string equal -nocase "all" $banlistremove]} {
putserv "ONOTICE $chan :Channel banlist currently has $banlistmax entries. Clearing the channel banlist."
resetbans $chan
return 0
}
}
}
}
|
_________________ ·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
================================== |
|
| Back to top |
|
 |
BrewMaster Voice
Joined: 07 Jul 2007 Posts: 34
|
Posted: Tue Jul 10, 2007 9:11 am Post subject: |
|
|
Thanks awyeah. Thats exactly what I was looking for. I am testing it now.
I am going to delete out the lines:
| Code: | | putserv "ONOTICE $chan :Channel banlist currently has $banlistmax entries. Removing the last $banlistremove bans placed." |
and:
| Code: | putserv "ONOTICE $chan :Channel banlist currently has $banlistmax entries. Clearing the channel banlist."
|
If I remove those 2 lines of code, I should not have any issues correct?
(other than its not going to tell the ops what its doing).
Thanks for the response and recoding of the old script.
brew |
|
| Back to top |
|
 |
awyeah Revered One

Joined: 26 Apr 2004 Posts: 1580 Location: Switzerland
|
Posted: Tue Jul 10, 2007 8:12 pm Post subject: |
|
|
No, the script should be just fine even after you delete those two lines. Those lines just send an OPNOTICE to the channel, before they start removing bans from the banlist. _________________ ·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
================================== |
|
| Back to top |
|
 |
BrewMaster Voice
Joined: 07 Jul 2007 Posts: 34
|
Posted: Wed Jul 11, 2007 6:58 am Post subject: |
|
|
| Thanks awyeah. The script is working great! |
|
| Back to top |
|
 |
|