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.

Auto Voice System

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
m
mvp1
Voice
Posts: 22
Joined: Thu Jan 27, 2022 4:28 am

Post by mvp1 »

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]
User avatar
CrazyCat
Revered One
Posts: 1304
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

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
m
mvp1
Voice
Posts: 22
Joined: Thu Jan 27, 2022 4:28 am

Post by mvp1 »

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"
User avatar
CrazyCat
Revered One
Posts: 1304
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

My bad... nick2hand
m
mvp1
Voice
Posts: 22
Joined: Thu Jan 27, 2022 4:28 am

Post by mvp1 »

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
User avatar
CrazyCat
Revered One
Posts: 1304
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

+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).
m
mvp1
Voice
Posts: 22
Joined: Thu Jan 27, 2022 4:28 am

Post by mvp1 »

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
      }
   }
} 

s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

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"
User avatar
CrazyCat
Revered One
Posts: 1304
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

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.
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

Hm ok CrazyCat
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

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.
User avatar
CrazyCat
Revered One
Posts: 1304
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

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
   }
}
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

thanks for pointing out CrazyCat i changed it in the post
Post Reply