; ***** autovoice: allows users to grab +v when the channel is set to +m (moderated). *****
; 1. This ONLY works in ONE channel at a time. BE SURE to set your own channel name throughout (#mychan by default)!
; 2. The autovoice function Automatically Enables when the channel mode changes to +m, and automatically disables on -m.
; 3. To turn off the auto enable feature, type /disable #autovoice. To turn it back on, type /enable #autovoice,
;or right-click in the channel and use the Menu. It's best to leave it on, unless there are errors/problems.
; 4. To immediately change the password, type /voicepassword - any requests in progress will fail due to the new password.
ON *:START:{ set %voicepassword $regsubex($str(x,50),/x/g,$rand(a,z)) }
ON *:CONNECT:{ if ($network == Undernet) set %voicepassword $regsubex($str(x,50),/x/g,$rand(a,z)) }
alias voicepassword {
return $hotp(%voicepassword $$1, $calc( ($ctime - $timezone + 0*3600) // 3600 ),sha256,6)
}
menu channel {
AutoVoice
.Enable AutoEnable:/enable #autovoice
.Disable AutoEnable:/disable #autovoice
.Generate New Passsword: /voicepassword
-
.set channel +m:/mode # +m
.set channel -m:/mode # -m
}
on 1:MODE:#mychan:{
if $1- == +m {
; creates a timer to send a message to the channel about getting voice. Set to 5 minutes. Change the 300 seconds to change the interval.
/timerMod 0 300 //msg #mychan The channel is being moderated. To get Voice (+nickname) to talk in channel, please send a message to me, with voiceme as the only text (copy and paste is easiest): /msg $me voiceme
; executes the timer immediately
/timerMod -e
enable #autovoice
; creates a fresh password - see above
/voicepassword
}
elseif $1- == -m {
disable #autovoice
/msg #mychan Channel Moderation is now off. Everyone can chat again :)
; turns off the message timer
/timerMod off
}
}
#autovoice off
;receive the intial voiceme message, do checks, send the password string
on *:TEXT:voiceme:?: {
;//echo -s request received
if $nick ison #mychan && $nick !isvoice #mychan {
;//echo -s is on the channel, not voice
.privmsg $nick Please reply with this text and I will give you voice ( copy and paste for best results. Please include: voiceme xxxxxx ): voiceme $voicepassword($nick)
}
elseif $nick ison #mychan && $nick isvoice #mychan {
.privmsg $nick You already have voice! Your messages are being ignored for 5 minutes.
.ignore -pu300 $nick
/closemsg $nick
}
else {
;//echo -s not in channel
.privmsg $nick You are not in channel and will be ignored for 5 minutes.
.ignore -pu300 $nick
.closemsg $nick
} ;close if
} ;close on text
on *:TEXT:voiceme *:?: {
if $nick ison #mychan && $nick !isvoice #mychan {
;outer if
;//echo -s $1 $2
;//echo -s nick in channel and not voiced
;//echo -s $voicepassword($nick)
if ($2 == $strip($voicepassword($nick))) {
;inner if
;//echo -s should have voice here
.mode #mychan +v $nick
.privmsg $nick Congrats! You have voice +v and can chat in channel.
.closemsg $nick
}
else {
;inner if
.privmsg $nick Sorry, that didn't match. Please copy and paste voiceme and the numbers: voiceme xxxxxx
.closemsg $nick
} ;close inner if
}
elseif $nick isvoice #mychan {
;back to outer if
.privmsg $nick You silly goose you already have voice! Your messages are being ignored for 5 minutes.
.ignore -pu300 $nick
.closemsg $nick
}
else {
;outer if
//echo -s $nick not in channel
.closemsg $nick
.ignore -pu300 $nick
} ;close outer if
} ;close ON TEXT
}
}
#autovoice end