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 

Search and display.

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


Joined: 10 Aug 2005
Posts: 5

PostPosted: Tue Jun 06, 2006 9:20 am    Post subject: Search and display. Reply with quote

Hi, i am looking for a script that will search within a specified directory for a text file, the search trigger would be $search <name>
The bot would then go on to list matching files (max of 10), then the user can type $display filename.txt and the bot would display the contents of the text file in priv message to the user.

I did search for the script but found nothing Sad

Any help would be great!
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Tue Jun 06, 2006 4:46 pm    Post subject: Reply with quote

What's the purpose of this? Soulds like something *warez* related..
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
Swinder
Voice


Joined: 10 Aug 2005
Posts: 5

PostPosted: Tue Jun 06, 2006 7:09 pm    Post subject: Reply with quote

I am starting like a shop sort of thing but based via IRC, user will be able to search for like CPU and the bot will display a list of 10 CPU's then a user can check out individual CPU's.
Back to top
View user's profile Send private message
Swinder
Voice


Joined: 10 Aug 2005
Posts: 5

PostPosted: Sun Jun 11, 2006 12:03 pm    Post subject: Reply with quote

Anyone intrested in helping out with the script?

Sorry to post again but i have literally got a week to show my boss that it can all be done via IRC, after a week he not going to bother Sad
Back to top
View user's profile Send private message
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Wed Jun 14, 2006 2:32 am    Post subject: Reply with quote

Quote:
Hi, i am looking for a script that will search within a specified directory for a text file, the search trigger would be $search <name>
The bot would then go on to list matching files (max of 10), then the user can type $display filename.txt and the bot would display the contents of the text file in priv message to the user.

I did search for the script but found nothing Sad

Any help would be great!


Code:
# no / at the end.
set folder ~/my/texts/here

# trigger
set trigger $

bind PUB -|- ${trigger}search  pub:search
bind PUB -|- ${trigger}display  pub:spew

proc pub:search {n u h c t} {
  global folder
  set results [lrange [glob -nocomplain $folder/[lindex [split $t] 0]] 0 9];#max of 10 results
  if {![llength $results]} {
    putserv "NOTICE $n :No results."
  } else {
    putserv "NOTICE $n :Found [llength $results] results: [join [tail $results]]"
  }
}

proc pub:spew {n u h c t} {
  global folder
  if {![file exists $folder/[lindex [split $t] 0]]} {
    putserv "NOTICE $n :That file doesn't exist."
  } else {
    set cont [split [read [set fd [open $folder/[lindex [split $t] 0] r]]] \n][close $fd]
    foreach line $cont {
      putserv "PRIVMSG $n :$line"
    }
  }
}

proc tail {list} {
  set r ""
  foreach i $list {
    lappend r [file tail $i]
  }
  return $r
}


(untested)
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