| View previous topic :: View next topic |
| Author |
Message |
paps Voice
Joined: 24 May 2007 Posts: 5
|
Posted: Thu May 24, 2007 4:39 pm Post subject: Vip Script Based on Hosts ? |
|
|
Hello
I'm looking for a very simple script. It should voice anyone who joins a specified channel if their host matches one in a text file.
Google doesnt give me anything.
Thx in advance |
|
| Back to top |
|
 |
xU Voice
Joined: 24 May 2007 Posts: 7
|
Posted: Thu May 24, 2007 5:02 pm Post subject: |
|
|
hi paps,
you can use script without read from file:
| Code: | ## set(s) ##
############
## channels
set chanvoice "#xU #qadsia"
## host voice
ser hosts {
"*@*.qualitynet.net"
"*xU@*.WeArab.Knights"
"*@qadsia.com"
}
## bind ##
##########
bind join - * proc:join
## proc ##
##########
proc proc:join { nick host hand chan } {
global chanvoice hosts
if {([isbotnick $nick]) || (![botisop $chan]) || (![lsearch -exact [string tolower $chanvoice] [string tolower $chan]] == "-1")} {return 0}
foreach hostv $hosts {
if {([string match -nocase "$hostv" $host])} {putquick "mode $chan +v $nick;break}
}
} |
|
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Thu May 24, 2007 6:48 pm Post subject: |
|
|
Add these hosts to a specific handle and give it the +v flag. Set your channel to +autovoice and they'll be autovoiced on join. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
paps Voice
Joined: 24 May 2007 Posts: 5
|
Posted: Fri May 25, 2007 9:16 am Post subject: |
|
|
Thanks xU and Sir_Fz. It will help me a lot
And now what about a script that voices only people that are authed on Quakenet with a certain account ?
The bot should voice anyone that is authed (Q account) with one of the account-name listed on a text file or something...
Is this possible ? (My bot is on quakenet)
Thanks :] |
|
| Back to top |
|
 |
xU Voice
Joined: 24 May 2007 Posts: 7
|
Posted: Fri May 25, 2007 11:33 am Post subject: |
|
|
## set(s) ##
############
## channels
set chanvoice "#xU #qadsia"
## filename
set filehost "hosts.txl"
## bind ##
##########
bind join - * proc:join
## proc ##
##########
proc proc:join { nick host hand chan } {
global chanvoice txtfile
if {([isbotnick $nick]) || (![botisop $chan]) || (![lsearch -exact [string tolower $chanvoice] [string tolower $chan]] == "-1")} {return 0}
set ropen [open $filehost r]
foreach hostv $ropen {
if {([string match -nocase "$hostv" $host])} {putquick "mode $chan +v $nick;break}
} |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Fri May 25, 2007 12:18 pm Post subject: |
|
|
@xU:
What good would using a foreach-loop on a filehandle do?
Were'nt you thinking of actually reading the content of the file?
Also, you forget to close it afterwards, leaving uneccesary filehandles open...
Furthermore, your braces {} are unbalanced, and using lsearch on a plain string is not advisable (actually, in some rare conditions it's really bad).
edit:
Might aswell include a piece of code that is working:
Assumes one hostmask per line within the voice.txt file
| Code: | set voicefile "voice.txt"
setudef flag filevoice
bind join - * join:checkvoice
proc join:checkvoice {nick host hand chan} {
if {[channel get $chan chanvoice] && ![isbotnick $nick] && [botisop $chan]} {
set _t [split [read [set fid [open $::voicefile "RDONLY"]]] "\n"]
close $fid
foreach h $_t {
if {[string match -nocase $h $host]} {
pushmode $chan +v $nick
return
}
}
}
} |
_________________ NML_375, idling at #eggdrop@IrcNET
Last edited by nml375 on Fri May 25, 2007 12:29 pm; edited 1 time in total |
|
| Back to top |
|
 |
paps Voice
Joined: 24 May 2007 Posts: 5
|
Posted: Fri May 25, 2007 12:26 pm Post subject: |
|
|
| thx xU, but as far as i can see your script is based on hosts, right ? I'd like a script that voices based on the "Authed as Account-Name" (which appears on the /whois of Quakenet). |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Fri May 25, 2007 12:32 pm Post subject: |
|
|
@paps:
As I am not familiar with Quakenet, which respose-code would be used to indicate the Q auth from a whois reply? _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
paps Voice
Joined: 24 May 2007 Posts: 5
|
Posted: Fri May 25, 2007 1:02 pm Post subject: |
|
|
Well, I dont think i really understand the question, but:
When you type /whois nick on quakenet you get something like this if the guy is authed :
| Quote: | nick is xxxx@xxxx.users.quakenet.org * Real Name
nick on +#channel #channel2 @#channel3
nick using port80b.se.quakenet.org Located at Port80, Sweden
nick is authed as xxxx
nick End of /WHOIS list. |
When you do a /whois on someone that is not authed, this is what you get :
| Quote: | nick is ~xxxxx@xxx-xx-xxx-x-xxx.xxx.host.net * Real Name
nick on #channel
nick using *.quakenet.org QuakeNet IRC Server
nick End of /WHOIS list. |
Is this enough to make a script work ?
thx |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Fri May 25, 2007 1:30 pm Post subject: |
|
|
I'll try to explain my query alittle better then;
Each response-line from a whois-query (such as the examples you posted) is preceeded with a numeric responsecode (three digits). These are used to allow the client to know what kind of information the server is sending.
Taking the second example you posted, what is actually sent from the server is this:
| Quote: | 311 nick ~xxxxx@xxx-xx-xxx-x-xxx.xxx.host.net * :Real Name
319 nick :#channel
312 nick *.quakenet.org :QuakeNet IRC Server
318 nick :End of /WHOIS list. |
What we need is the number for the "nick is authed as xxxx" line. Unfortunately, this is not a "rfc 1459" message, but a QuakeNet feature (yes, some other networks use it aswell, I know...)
Also worth noting, implementing this would require your bot to send a whois-query whenever someone joins the channel. On highly trafficed channels this might cause some performace degradations.. just so you know. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Fri May 25, 2007 2:01 pm Post subject: |
|
|
You can use a /who reply for this (raw 354 reply)
| Code: | set chanvoice(channel) "#channel"
set chanvoice(file) "chanvoice.txt"
proc chanvoice:join {nick host hand chan} {
global chanvoice
if {![string equal -nocase $chanvoice(channel) $chan]} { return }
puthelp "WHO $nick n%a"
}
proc chanvoice:raw {from raw arg} {
global chanvoice
set nick [lindex [split $arg] 1]
set auth [lindex [split $arg] 2]
if {$auth == "" || $auth == "0"} { return }
set data [read -nonewline [set file [open "$chanvoice(file)" r]]]
close $file
foreach x [split $data \n] {
if {$x == ""} { return }
if {[string equal -nocase $auth $x]} {
pushmode $chanvoice(channel) +v $nick
break
}
}
} |
Not tested, but can be used as a basebone... _________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Fri May 25, 2007 2:36 pm Post subject: |
|
|
Interresting, I suppose this could be extended to create a database of auth'd nicks (and their accuntname) by extending the WHO-query to the speciffic channel when the bot joins.
Should also be trivial to modify the raw 354 "handler" to update a list of nick/auths-pairs to cache this information in order to further reduce traffic.
Might almost be worth writing a module..
Edit:
Just found this page that provided some nice information: http://www.mircscripts.org/showdoc.php?type=tutorial&id=2412
Might be a good idea to tag the query in case any other scripts would use these extended /WHO-queries. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Fri May 25, 2007 2:45 pm Post subject: |
|
|
the t option can be added.
A fixed version with the t paramater:
| Code: | set chanvoice(channel) "#channel"
set chanvoice(file) "chanvoice.txt"
proc chanvoice:join {nick host hand chan} {
global chanvoice
if {![string equal -nocase $chanvoice(channel) $chan]} { return }
puthelp "WHO $nick n%at,88"
}
proc chanvoice:raw {from raw arg} {
global chanvoice
set tag [lindex [split $arg] 1]
if {$tag != "88"} { return }
set nick [lindex [split $arg] 2]
set auth [lindex [split $arg] 2#3]
if {$auth == "" || $auth == "0"} { return }
set data [read -nonewline [set file [open "$chanvoice(file)" r]]]
close $file
foreach x [split $data \n] {
if {$x == ""} { return }
if {[string equal -nocase $auth $x]} {
pushmode $chanvoice(channel) +v $nick
break
}
}
} |
The tag in this example is 88. _________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Fri May 25, 2007 2:47 pm Post subject: |
|
|
You'd still need some bindings I suppose... and [lindex ... 2#3] ? :p _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
paps Voice
Joined: 24 May 2007 Posts: 5
|
Posted: Fri May 25, 2007 2:53 pm Post subject: |
|
|
So, what would be the bindings ?
I dont understand anything in TCL  |
|
| Back to top |
|
 |
|