egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

chanserv - parsing possibly? - SOLVED

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
PaulyboyUK
Voice


Joined: 09 Oct 2008
Posts: 12

PostPosted: Fri Nov 14, 2008 5:29 am    Post subject: chanserv - parsing possibly? - SOLVED Reply with quote

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
Back to top
View user's profile Send private message
PaulyboyUK
Voice


Joined: 09 Oct 2008
Posts: 12

PostPosted: Thu Nov 27, 2008 5:13 pm    Post subject: Reply with quote

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

Paul
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Fri Nov 28, 2008 12:03 pm    Post subject: Reply with quote

hello

Code:
# 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:
bind pub - list do_query


to

Code:
bind pub n list do_query


I think u alread know this etc. Smile

cheers
Back to top
View user's profile Send private message Visit poster's website
PaulyboyUK
Voice


Joined: 09 Oct 2008
Posts: 12

PostPosted: Sun Nov 30, 2008 8:00 pm    Post subject: Reply with quote

ty for taking time on this mate Smile

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
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Mon Dec 01, 2008 5:58 am    Post subject: Reply with quote

hmm, weird

maybe this chanserv is diffrent :>

look, chanserv output from shadow-dragon:
Quote:
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:
Quote:
[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 Smile
Back to top
View user's profile Send private message Visit poster's website
PaulyboyUK
Voice


Joined: 09 Oct 2008
Posts: 12

PostPosted: Mon Dec 01, 2008 6:24 pm    Post subject: Reply with quote

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

Quote:


[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

Quote:


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
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Tue Dec 02, 2008 8:47 am    Post subject: Reply with quote

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

Quote:


[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

Quote:


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:
# 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 Smile

hf
Back to top
View user's profile Send private message Visit poster's website
PaulyboyUK
Voice


Joined: 09 Oct 2008
Posts: 12

PostPosted: Tue Dec 02, 2008 6:15 pm    Post subject: Reply with quote

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

Regards

Paul
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber