guest types !request
bot pms user asking 3 questions username,password,email
user pms bot username,password,email
bot then saves that username,password,email into a text file
set eTxFile(file) {/home/computertech/tech/scripts/add.txt}
bind pub -|- !request pub:register
proc pub:register {nick uhost hand chan text} {
if {[scan $text {%s%s%s} user password email] != 3} {
putserv "notice $nick :usage: !request user password email"
return
}
if {[string tolower $chan] ne [string tolower $::eTxFile(chan)]} { return }
set tf $::eTxFile(file)
if {![file exists $tf]} {
puthelp "notice $nick :Text file does not exist: $tf"
return
}
puthelp "notice $nick :You Have Requested A Bnc/Znc, This the info you provided $text "
set id [open $tf a]
puts $id $text
close $id
return
}
so now all i need is this one thing
instead of users typing openly !request username password email
i would like them to type it into the private message of the bot
And Not /msg botnick username password email
but rather the bot will pm the user saying what to do then the user will type !request username password email
would bind msg do for this? because i tried it but it only seems to work when i did /msg botnick message
The putserv "notice $nick part is responsible for where is the message going to be sent and in what format. In this given example it will be sent to $nick as a notice. If you want to make it a private message (PM) then change 'notice' into 'privmsg'.
You need to alter the code so the '!request' part only sends out that private message to the person issuing the command on the channel and make a new function that would listen on a 'bind msg' to do the actual recording that is done at the moment inside the public !request one.
I would honestly generate a random password and tell the user to change it after he/she connects to Bnc/Znc.
alright so i figured a random password script, now just need to add the valid email line
and this
You need to alter the code so the '!request' part only sends out that private message to the person issuing the command on the channel and make a new function that would listen on a 'bind msg' to do the actual recording that is done at the moment inside the public !request one.
but if course if you would like to add a password generator that would be awesome also, caesar. mine might not be that a good heh
I built this largely based on the scripts already written for you. It includes a random password generator. It looks like there is some of this conversation I can't see so I may be missing something.
Anyway, I tested it and it works well. I borrowed randomRangeString from the TCLers Wiki
proc randPass {len {min 33} {max 125}} {
return [subst [string repeat {[format %c [expr int(rand()*($max-$min+1)) + $min]]} $len]]
}
bind pub -|- !request pub:request
proc pub:request {nick uhost hand chan text} {
if {[scan $text {%s%s} user email] != 2} {
putserv "NOTICE $nick :usage: !request user email"
return
}
set pass [randPass 10]
puthelp "NOTICE $nick :You have requested a Bnc/Znc with the info that you provided: username: $user, e-mail: $email. A random password \002$pass\002 was generated for you that you should change later."
set fh [open "/home/computertech/tech/scripts/add.txt" "a+"]
puts $fh "$user $email $pass"
close $fh
}
This generates a password from the ASCII table from element 33 ("!" symbol) up to 125 ("}" symbol). You can change the range by telling randPass the min and the max it should grab and generate from the ASCII table.
If the file doesn't exist then it will be created (empty file) and the initial access position will be set to the end of the file.
Once the game is over, the king and the pawn go back in the same box.