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 » Tue Feb 01, 2022 8:20 am
HI @Caesar /all, I am trying to test a similar av system and thank you very much for your code mate. I am using below code successfully and its working fine for voice g flag users and then devoicing every user after set time. I tried the exeptions code you mentioned but it didn't work properly. Appreciate if you can write me a exception code which I can add to this, where it does not devoice the exception users? I want to add exception users manually by for example giving them another flag or something? so the code can check if the user have exception flag, then not devoice it.
Code: Select all
namespace eval idleDevoice {
# Default idle time in minutes
set idleTime 2
setudef flag idleDevoice
bind cron - {* * * * *} [namespace current]::idle:cron
bind pubm g|g * [namespace current]::idle:voice
proc idle:cron {min hour day month weekday} {
variable idleTime
set now [clock seconds]
foreach channel [channels] {
if {![channel get $channel idleDevoice]} continue
if {![botisop $channel]} continue
foreach member [chanlist $channel] {
if {[isbotnick $member]} continue
if {[isop $member $channel] || ![isvoice $member $channel]} continue
# set handle [nick2hand $member $channel]
# if {[matchattr $handle e]} return
set chanidle [getchanidle $member $channel]
if {$chanidle >= $idleTime} {
lappend userList $member
}
}
if {[info exists userList]} {
idle:push $channel $userList
}
}
}
proc idle:voice {nick uhost hand chan text} {
if {![botisop $chan]} return
if {[isvoice $nick $chan]} return
pushmode $chan +v $nick
}
proc idle:push {channel userList} {
if {![botisop $channel]} return
set max 6
set len [llength $userList]
while {$len > 0} {
if {$len > $max} {
set mode [string repeat "v" $max]
set users [join [lrange $userList 0 [expr {$max - 1}]]]
set userList [lrange $userList $max end]
incr len -$max
} else {
set mode [string repeat "v" $len]
set users [join $userList]
set len 0
}
pushmode $channel -$mode $users
}
}
}
[/code]
CrazyCat
Revered One
Posts: 1302 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Tue Feb 01, 2022 8:43 am
If your users are in bot's userlist, add them the +V flag (global or per channel)
Then, find the following line:
Code: Select all
if {[isop $member $channel] || ![isvoice $member $channel]} continue
Replace it with:
Code: Select all
if {[isop $member $channel] || ![isvoice $member $channel] || [matchattr [nick2handle $member] +V|+V $channel]} continue
mvp1
Voice
Posts: 22 Joined: Thu Jan 27, 2022 4:28 am
Post
by mvp1 » Wed Feb 02, 2022 6:24 am
Hi CrazyCat, thanks mate. I've testing it now and getting below error;
[05:23:00] Tcl error [::idleDevoice::idle:cron]: invalid command name "nick2handle"
CrazyCat
Revered One
Posts: 1302 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Wed Feb 02, 2022 6:50 am
My bad... nick2hand
mvp1
Voice
Posts: 22 Joined: Thu Jan 27, 2022 4:28 am
Post
by mvp1 » Wed Feb 02, 2022 7:00 am
Cheers CrazyCat, the +V flag exception works now. Legend mate.
However, I just picked up another issue. The eggdrop seems to be enforcing the voice on +g flag users? I'm not too sure if there's something we could do with this code, or with my .chaninfo settings for the channel?
Below is example,
(after it voices a +g user when users speak, if any other OP devoices it manually, it voices it back) (Also when a +g user is currently devoice, and if any other user devoice it again, the bot puts it back on voice, until the devoice timer 2 mins, when bot devoices it itself)
[23:49] <User1> hi
[23:49] * Bot sets mode: +v User1
[23:49] * AnotherOP sets mode: -v User1
[23:49] * Bot sets mode: +v User1
[23:52] * Bot sets mode: -v User1
[00:11] * AnotherOp sets mode: -v User1
[00:11] * Bot sets mode: +v User1
Below is my .chaninfo output;
[23:50] <AnotherOP> .chaninfo #channel123
[23:50] <Bot> Settings for dynamic channel #channel123:
[23:50] <Bot> Protect modes (chanmode): +tn
[23:50] <Bot> Idle Kick after (idle-kick): DON'T!
[23:50] <Bot> stopnethack: DON'T!
[23:50] <Bot> aop-delay: 5:30
[23:50] <Bot> revenge-mode: 0
[23:50] <Bot> ban-type: 3
[23:50] <Bot> ban-time: 120
[23:50] <Bot> exempt-time: 60
[23:50] <Bot> invite-time: 60
[23:50] <Bot> Other modes:
[23:50] <Bot> -inactive -statuslog -secret +shared
[23:50] <Bot> +greet -seen +cycle +dontkickops
[23:50] <Bot> +protectops -protectfriends -revenge -revengebot
[23:50] <Bot> -bitch -autoop -autovoice -nodesynch
[23:50] <Bot> -enforcebans -dynamicbans -userbans -autohalfop
[23:50] <Bot> -protecthalfops -static
[23:50] <Bot> +dynamicexempts +userexempts +dynamicinvites +userinvites
[23:50] <Bot> User defined channel flags:
[23:50] <Bot> +idleDevoice -nopubstats -quietstats -nostats
[23:50] <Bot> -noseendata -quietseens -quietaiseens -nopubseens
[23:50] <Bot> flood settings: chan ctcp join kick deop nick
[23:50] <Bot> number: 15 3 5 3 3 5
[23:50] <Bot> time : 60 60 60 10 10 60
[23:50] <Bot> [05:50:01] #AnotherOp# chaninfo #channel123
CrazyCat
Revered One
Posts: 1302 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Wed Feb 02, 2022 7:16 am
+g is auto-voice flag (
https://docs.eggheads.org/mainDocs/users.html ), so it's normal the voice is enforced.
Change the bind to v|v and give your users the +v flag rather than the +g.
I did
advoice script a long time before, I'll work on it to make it suit your need.
Actually, it voices any user joining or speaking (unless the user is op/halfop) and devoice idle users after a delay (global or per channel).
mvp1
Voice
Posts: 22 Joined: Thu Jan 27, 2022 4:28 am
Post
by mvp1 » Mon Aug 01, 2022 8:59 am
Hi CrazyCat, Ceasar,
I'm using below code, it is working but it does not seem to devoice all the nicks which are sitting on voice more than idle time? When the channel is 150+ count and voiced users are 10-15, many voiced users stay voiced and do not get devoiced. Below is complete code I am using.
Voicing +V and Exception +G are working fine. But devoicing seems to have a problem or lag when there are 10-15 users sitting on voice.
Any thoughts what is going wrong? Or if something can be changed with the code?
Many thanks
Code: Select all
namespace eval idleDevoice {
## Default idle time in minutes
set idleTime 28
setudef flag idleDevoice
### Bind Cron every 5 mins ###
bind cron - {*/5 * * * *} [namespace current]::idle:cron
### Bind on pub msg from V flag users
bind pubm V|V * [namespace current]::idle:voice
### MAIN PROC ###
proc idle:cron {min hour day month weekday} {
variable idleTime
set now [clock seconds]
foreach channel [channels] {
if {![channel get $channel idleDevoice]} continue
if {![botisop $channel]} continue
foreach member [chanlist $channel] {
if {[isbotnick $member]} continue
if {[isop $member $channel] || ![isvoice $member $channel] || [matchattr [nick2hand $member] +G|+G $channel]} continue
# set handle [nick2hand $member $channel]
# if {[matchattr $handle e]} return
set chanidle [getchanidle $member $channel]
if {$chanidle >= $idleTime} {
lappend userList $member
}
}
if {[info exists userList]} {
idle:push $channel $userList
}
}
}
proc idle:voice {nick uhost hand chan text} {
if {![botisop $chan]} return
if {[isvoice $nick $chan]} return
pushmode $chan +v $nick
}
proc idle:push {channel userList} {
if {![botisop $channel]} return
set max 3
set len [llength $userList]
while {$len > 0} {
if {$len > $max} {
set mode [string repeat "v" $max]
set users [join [lrange $userList 0 [expr {$max - 1}]]]
set userList [lrange $userList $max end]
incr len -$max
} else {
set mode [string repeat "v" $len]
set users [join $userList]
set len 0
}
pushmode $channel -$mode $users
}
}
}
simo
Revered One
Posts: 1108 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Mon Aug 01, 2022 2:08 pm
i tested this and it seems to work for me :
Code: Select all
namespace eval idleDevoice {
## Default idle time in minutes
set idleTime 28
setudef flag idleDevoice
### Bind Cron every 5 mins ###
bind cron - {*/5 * * * *} [namespace current]::idle:cron
### Bind on pub msg from V flag users
bind pubm V|V * [namespace current]::idle:voice
### MAIN PROC ###
proc idle:cron {min hour day month weekday} {
variable idleTime
set now [clock seconds]
foreach channel [channels] {
if {![channel get $channel idleDevoice]} continue
if {![botisop $channel]} continue
foreach member [chanlist $channel] {
if {[isbotnick $member]} continue
if {[isop $member $channel] || ![isvoice $member $channel] || [matchattr [nick2hand $member] +G|+G $channel]} continue
# set handle [nick2hand $member $channel]
# if {[matchattr $handle e]} return
set chanidle [getchanidle $member $channel]
if {$chanidle >= $idleTime} {
lappend userList $member
}
}
if {[info exists userList]} {
idle:push $channel $userList
}
}
}
proc idle:voice {nick uhost hand chan text} {
if {![botisop $chan]} return
if {[isvoice $nick $chan]} return
pushmode2 $chan +v $nick
}
proc idle:push {channel userList} {
if {![botisop $channel]} return
set max 3
set len [llength $userList]
while {$len > 0} {
if {$len > $max} {
set mode [string repeat "v" $max]
set users [join [lrange $userList 0 [expr {$max - 1}]]]
set userList [lrange $userList $max end]
incr len -$max
} else {
set mode [string repeat "v" $len]
set users [join $userList]
set len 0
}
puthelp "mode $channel -$mode $users"
}
}
}
i changed the :
pushmode $channel -$mode $users
into :
puthelp "mode $channel -$mode $users"
CrazyCat
Revered One
Posts: 1302 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Tue Aug 02, 2022 3:17 am
adding a flushmode right after the pushmode is more the way it may work.
It actually works with puthelp because your eggdrop isn't too much loaded and haven't to send lot of msg, but using a message queue to send modes is not the solution.
simo
Revered One
Posts: 1108 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Wed Aug 03, 2022 12:21 am
Hm ok CrazyCat
simo
Revered One
Posts: 1108 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Wed Aug 03, 2022 3:36 am
this seems to work for me :
Code: Select all
namespace eval idleDevoice {
## Default idle time in minutes
set idleTime 28
setudef flag idleDevoice
### Bind Cron every 5 mins ###
bind cron - {*/5 * * * *} [namespace current]::idle:cron
#Bind on pub msg from V flag users
bind pubm V|V * [namespace current]::idle:voice
### MAIN PROC ###
proc idle:cron {min hour day month weekday} {
variable idleTime
set now [clock seconds]
foreach channel [channels] {
if {![channel get $channel idleDevoice] || ![botisop $channel]} continue
foreach member [chanlist $channel] {
if {[isbotnick $member] || [isop $member $channel] || ![isvoice $member $channel] || [matchattr [nick2hand $member] +G|+G $channel]} continue
# set handle [nick2hand $member $channel]
# if {[matchattr $handle e]} return
set chanidle [getchanidle $member $channel]
if {$chanidle >= $idleTime} {
pushmode $channel -v $member
}
}
flushmode $channel
}
}
proc idle:voice {nick uhost hand chan text} {
if {![botisop $chan] || [isvoice $nick $chan]} return
pushmode $chan +v $nick
}
}
Last edited by
simo on Wed Aug 03, 2022 4:11 am, edited 1 time in total.
CrazyCat
Revered One
Posts: 1302 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Wed Aug 03, 2022 3:56 am
With a better indentation, you might have seen that the flushmode is in the wrong place.
It must be in the
foreach channel loop. Actually, it flushes only for the last channel, so it may slow the application of the modes for the firsts channels in eggdrop list.
Code: Select all
proc idle:cron {min hour day month weekday} {
variable idleTime
set now [clock seconds]
foreach channel [channels] {
if {![channel get $channel idleDevoice] || ![botisop $channel]} continue
foreach member [chanlist $channel] {
if {[isbotnick $member] || [isop $member $channel] || ![isvoice $member $channel] || [matchattr [nick2hand $member] +G|+G $channel]} continue
# set handle [nick2hand $member $channel]
# if {[matchattr $handle e]} return
set chanidle [getchanidle $member $channel]
if {$chanidle >= $idleTime} {
pushmode $channel -v $member
}
}
flushmode $channel
}
}
simo
Revered One
Posts: 1108 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Wed Aug 03, 2022 4:12 am
thanks for pointing out CrazyCat i changed it in the post