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.

chanserv - parsing possibly? - SOLVED

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
P
PaulyboyUK
Voice
Posts: 12
Joined: Thu Oct 09, 2008 6:45 pm

chanserv - parsing possibly? - SOLVED

Post by PaulyboyUK »

hi

i am looking to create a userlist on one channel - it will be required to save as a text file in the format

username1
username2
username3
username4 etc

I have found a chanserv access list script on here but the fomat of the output is no where near - ie

VOP list for #test:
VOP list for #test:
VOP list for #test:
Num Nick
2 PeaceKeeper

the code i am currently using to create this is



Code:


# Name of the storage file for the access list.
set accesslist "accesslist.txt"

# Full name of channel services.
set chanserv "chanserv"

#################
# BIND commands #
#################
bind pub n list access:list
bind notc - "* list for *" write:list
bind notc - "* VOP *" write:list

proc write:list {nick host hand arg {dest ""}} {
set msg $arg
if {([isbotnick $dest]) && ([string equal $nick "ChanServ"])} {
# Create the storage file for appending.
set acc_fd [open $::accesslist a]
puts $acc_fd $msg
close $acc_fd
}
}

proc access:list {nick uhost hand chan text} {
set type [string tolower $text]
if {[regexp {(sop|aop|vop)} $type]} {
# Remove old storage file
if {[file exists $::accesslist]} {file delete $::accesslist}
putserv "PRIVMSG $::chanserv :$type $chan list"
} else {
return
}
}

# ctrl:filter <string>
# Strip all control characters. Thanks to ppslim.

proc ctrl:filter {str} {
regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026|\006|\007} $str "" str
return $str
}



I dont understand the above creates 3 lines of test saying VOP list as example above etc

i need the file to literally just have the Voiced users of the channel - and theni can use that file in my other script to dcc mass send files - seems no matter where i go i seemto hit a brick wall - any pointers would be great -


Thanks in anticipation

Paul
Last edited by PaulyboyUK on Wed Dec 03, 2008 5:32 am, edited 1 time in total.
P
PaulyboyUK
Voice
Posts: 12
Joined: Thu Oct 09, 2008 6:45 pm

Post by PaulyboyUK »

bump - sorry just still need help on this one - if anyone can would be really appreciated

Paul
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

hello

Code: Select all

# Author: tomekk
# e-mail:  tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.1
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html

# file with nicks
set nicks_db "lusers.txt"

# service name
set service_name "chanserv"

#################################################################################
bind pub - list do_query
bind notc - "*" grab_list

proc do_query { nick uhost hand chan arg } {
	global service_name nicks_db

	if {[file exists $nicks_db]} {
		file delete $nicks_db
	}

	putserv "PRIVMSG $service_name :vop $chan list"
}

proc grab_list { nick uhost hand text {dest ""}} {
	global botnick service_name nicks_db
       
	if {$dest == ""} {
		set dest $botnick
	}

	if {([isbotnick $dest]) && ([string tolower $nick] == $service_name)} {
		set split_text [split $text "\n"]

		set db_hand [open $nicks_db a] 
		foreach text_line $split_text {
			if {[regexp {^([0-9]+):.+$} $text_line]} {
				set only_nick [string trim [lindex [split $text_line] 1]]
				regsub -all -nocase {\002} $only_nick "" only_nick
				puts $db_hand $only_nick
			}
		}
		close $db_hand
	}
}

putlog "chanserv-list.tcl ver 0.1 by tomekk loaded"
I wrote some script for u, try it.
After quote "list" on channel u will get file with VOP list (if any exists)
I tested it with ChanServ from irc.shadow-dragon.net

If u want to use this command only when u have +n
change:

Code: Select all

bind pub - list do_query
to

Code: Select all

bind pub n list do_query
I think u alread know this etc. :)

cheers
P
PaulyboyUK
Voice
Posts: 12
Joined: Thu Oct 09, 2008 6:45 pm

Post by PaulyboyUK »

ty for taking time on this mate :)

Unfortunately it creates the lusers text file but nothing is created in it - when i am in dcc chat i see the list being got - but nothing added to the file - will keep plugging away
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

hmm, weird

maybe this chanserv is diffrent :>

look, chanserv output from shadow-dragon:
0:55:16 <tomekk> vop #tomekk-test list
10:55:17 -ChanServ(ChanServ@services.shadow-dragon.net)- VOP list for #tomekk-test:
10:55:17 -ChanServ(ChanServ@services.shadow-dragon.net)- 1: test (not logged in)
10:55:17 -ChanServ(ChanServ@services.shadow-dragon.net)- 2: test2 (not logged in)
10:55:17 -ChanServ(ChanServ@services.shadow-dragon.net)- 3: test3 (not logged in)
10:55:17 -ChanServ(ChanServ@services.shadow-dragon.net)- Total of 3 entry in VOP list of #tomekk-test.
and after typing "list" on chan, bot:
[tomekk@zonk]:~/eggdrop# cat lusers.txt
test
test2
test3
try to change "bind pub - list do_query" to "bind pub - !test do_query" and after that write "!test" on your channel

if this will not work then we will try smth else :)
P
PaulyboyUK
Voice
Posts: 12
Joined: Thu Oct 09, 2008 6:45 pm

Post by PaulyboyUK »

Ok m8 thankyou for your help - heres wheres it at currently - if i do a vop list - or do list with your script below is what i see returned when i am in partyline chat with bot

[22:15] <TestBot> [00:13] -ChanServ (services@eagle-nest.net)- VOP list for #test:
[22:15] <TestBot> [00:13] -ChanServ (services@eagle-nest.net)- Num Nick
[22:15] <TestBot> [00:13] -ChanServ (services@eagle-nest.net)- 4 PeaceKeeper
[22:15] <TestBot> [00:13] -ChanServ (services@eagle-nest.net)- 5 cdclub
I note only difference to yours in that yours indicated the end of the list

testserver@command:~/botroom/testbot$ cat lusers.txt
testserver@command:~/botroom/testbot$
as you can see the lusers file is created however contains absolutely nothing - any ideas?

Cheers

Paul
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

PaulyboyUK wrote:Ok m8 thankyou for your help - heres wheres it at currently - if i do a vop list - or do list with your script below is what i see returned when i am in partyline chat with bot

[22:15] <TestBot> [00:13] -ChanServ (services@eagle-nest.net)- VOP list for #test:
[22:15] <TestBot> [00:13] -ChanServ (services@eagle-nest.net)- Num Nick
[22:15] <TestBot> [00:13] -ChanServ (services@eagle-nest.net)- 4 PeaceKeeper
[22:15] <TestBot> [00:13] -ChanServ (services@eagle-nest.net)- 5 cdclub
I note only difference to yours in that yours indicated the end of the list

testserver@command:~/botroom/testbot$ cat lusers.txt
testserver@command:~/botroom/testbot$
as you can see the lusers file is created however contains absolutely nothing - any ideas?

Cheers

Paul
yap, its a little bit diffrent, try this one:

Code: Select all

# Author: tomekk
# e-mail:  tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.1
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html

# file with nicks
set nicks_db "lusers.txt"

# service name
set service_name "chanserv"

#################################################################################
bind pub - list do_query
bind notc - "*" grab_list

proc do_query { nick uhost hand chan arg } {
	global service_name nicks_db

	if {[file exists $nicks_db]} {
		file delete $nicks_db
	}

	putserv "PRIVMSG $service_name :sop $chan list"
}

proc grab_list { nick uhost hand text {dest ""}} {
	global botnick service_name nicks_db
       
	if {$dest == ""} {
		set dest $botnick
	}

	if {([isbotnick $dest]) && ([string tolower $nick] == [string tolower $service_name])} {
		set text_line $text

		set db_hand [open $nicks_db a] 
		if {[regexp {^.*([0-9]+).*$} $text_line]} {
			set only_nick [lindex [split [string trim $text_line]] 2]
			puts $db_hand $only_nick
		}
		close $db_hand
	}
}

putlog "chanserv-list.tcl ver 0.1 by tomekk loaded"
I tested it on eagle-nest, it should work good :)

hf
P
PaulyboyUK
Voice
Posts: 12
Joined: Thu Oct 09, 2008 6:45 pm

Post by PaulyboyUK »

Solved - ty mate thats spot on - now for me to startdcc side thankyou

Regards

Paul
Post Reply