I made this by request from a forum. User friendly Popup menus in: nicklist, channel, and custom window. No commands required. Will autovoice anyone who enters unless their host is in the 'Devoice List'. Also allows person to execute timed mutes, timers are preset and customizable in minutes and hours. Also won't execute in rooms you're not operator. Channel must be moderated to even have 'muting' available: '+m'.
To create the '.txt' file needed for autovoice on join, just Devoice someone (eg. a dummy account) then "De-Devoice" them. Hope you enjoy this, gave me a few good headaches making it. =p And thanks to Riamus2 for helping me create it.
alias DVoice {
if ($me isop $chan) {
if ($read(dvupkeep.txt, s, $address($1, 1)) == $null) {
if ($2 isnum) {
mode # -v $1
write dvupkeep.txt $address($1, 1) - $1
.timerdv $+ $1 1 $2 mode # +v $1
.timerdv2 $+ $1 1 $2 write -ds $+ $address($1, 1) dvupkeep.txt
}
else {
mode # -v $1
write dvupkeep.txt $address($1, 1) - $1
}
}
else { echo # That person is already in the Devoice List. }
}
else { echo # Can't perform action. $me is not an Operator in $chan $+ . }
}
on *:JOIN:#: {
if ( $me isop $chan ) && ( $read(dvupkeep.txt, s, $address($nick,1) ) != $null ) { notice $nick You are still muted. }
else { mode # +v $nick }
}
Menu channel {
View Devoice List:{
window @Devoice -l
filter -fw dvupkeep.txt @Devoice
}
}
Menu nicklist {
Devoice 'EM!
.Perm DVoice: { DVoice $1 }
.Timed DV
..1 Minute: { DVoice $1 60 }
..5 Minutes: { DVoice $1 300 }
..15 Min: { DVoice $1 900 }
..30 Min: { DVoice $1 1800 }
..Custom Mins!: {
$?="Enter how many minutes."
DVoice $1 $calc( $! * 60 )
}
..Custom Hrs!!: {
$?="Enter how many hours."
DVoice $1 $calc( $! * 60 ^ 2 )
}
De-Devoice: {
write -ds $+ $address($1,1) dvupkeep.txt
mode # +v $1
.timerdv $+ $1 off
.timerdv2 $+ $1 off
}
}
Menu @Devoice {
Refresh List: {
if ($window(@Devoice)) { clear @Devoice }
else { window @Devoice -l }
filter -fw dvupkeep.txt @Devoice
}
}
on mods:TEXT:!dvoice*:#:{
/mode # -v $$2
/write dvupkeep.txt $address($2, 1) - 1
if ($3 isnum) {
/msg # 4,1 $$2 's voice has been taken away for $$3 seconds.
.timerdv $+ $$2 1 $3 /mode # +v $$2
.timerdv2 $+ $$2 1 $3 /write -ds $+ $address($2, 1) dvupkeep.txt
}
else {
/msg # 4,1 $$2 's voice has been taken away.
}
}
on mods:TEXT:!voice*:#:{
/mode # +v $$2
/write -ds $+ $address($$2, 1) dvupkeep.txt
}
Ok, I fixed the hopping problem. I don't know why I thought I would have to write it from scratch since it's in the originally posted script. But, here you go.
on mods:TEXT:!dvoice*:#:{
/mode # -v $$2
/write dvupkeep.txt $address($2, 1) - 1
if ($3 isnum) {
/msg # 4,1 $$2 's voice has been taken away for $$3 seconds.
.timerdv $+ $$2 1 $3 /mode # +v $$2
.timerdv2 $+ $$2 1 $3 /write -ds $+ $address($2, 1) dvupkeep.txt
}
else {
/msg # 4,1 $$2 's voice has been taken away.
}
}
on mods:TEXT:!voice*:#:{
/mode # +v $$2
/write -ds $+ $address($$2, 1) dvupkeep.txt
}
Hope this works since I can't test it. =/ I'll check back here, tonight. Later.
on mods:TEXT:!dvoice* part devoices them. The 2nd part voices them back if you change your mind. =p
To devoice for 2 minutes type: !dvoice Username 120
The "Reason:" bit was me messing around with ideas. That part can be deleted:
/msg # 12,1 Reason: $4-
!voice will just override the timer like if you !dvoice someone for an hour and change your mind like 10 minutes into the wait. And yes hopping will mess this up. I'll write you a bit to stop that tonight. =p
You'll need to make a user level for "mods". I would go more in depth but I have to leave REALLY soon. But here's the code... =/ I forgot how to make part of this a "Code:" -- my horrible memory.
on mods:TEXT:!dvoice:#:{
/mode # -v $$2
/msg # 4,1 $$2 's voice has been taken away for $$3 seconds.
/msg # 12,1 Reason: $4-
/timer 1 $$3 /mode # +v $$2
}
on mods:TEXT:!voice:#:/mode # +v $$2
With the "mods" level, it'll only allow whoever has that user level to use it, not just everyone in the room. I also have a way to keeping people muted when they exit and come back but I'm pressed for time. If no one else posts a way of doing this, I will tonight. Sadly this only works for seconds, again if no one posts a minutes version, I'll do so tonight. I quickly grabbed this off of my old bot needs some re-working. But this should get you going.
Great snippet, but for me the "Perm DVoice" does not seem to work. I set a Perm DVoice on someone and when they come back they still get voice and I get this error "ERROR 401: No such nick/channel: is". And this error keeps on regenerating in the chat every second and fills the chat. All of the other options for this snippet seem to work. Also I do not want all others to get auto voice. I use this on Ustream and do not want the Ustreamers auto voiced.
There are two parts of your code can be made shorter:> Menu @Devoice {
Refresh List: {
$iif($window(@Devoice),clear $v1,window $v1 -l)
filter -fw dvupkeep.txt @Devoice
}
}That substitutes for if-then-else condition.
on @*:JOIN:#: {
if ( $read(dvupkeep.txt, s, $address($nick,1) ) != $null ) { notice $nick You are still muted. }
else { mode # +v $nick }
}The @ is defined as: if ($me isop $chan) {