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 

A very simple script that fills one file with certain lines.

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


Joined: 04 May 2006
Posts: 8

PostPosted: Thu May 04, 2006 11:05 am    Post subject: A very simple script that fills one file with certain lines. Reply with quote

Okay, first of all, I don't know anything about TCL Smile and because of that i am requesting a simple (it seems simple to a guy who knows TCL) script that must do the following:

When a user, named, for example "Uberpwner1", in certain channel writes "!banrequest Somenick http://someimagefileontheinternet.png A short comment" the bot adds a new line to some certain file. For example, a file banrequests.txt would get a line like this:
"Uberpwner1|Somenick|http://someimagefileontheinternet.png|A short comment|Currenttime"
And that would pretty much be it, that would be the MUST HAVE section Smile

But also it would be very appreciated if the output file contained writers and Somenicks host and after they write that !banrequest line, there would be somekind of a feedback line msgd to them.
And one other appreciated feature would be that the script will announce "new request" or smth like that on a different channel.
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu May 04, 2006 2:10 pm    Post subject: Reply with quote

Code:
bind pub m !banrequest banrequest

proc banrequest {nick uhost hand chan arg} {
 set file scripts/banrequests.txt
 foreach {n w} [split $arg] {break}
 set c [join [lrange [split $arg] 2 end]]
 if {![file exists $file]} { close [open $file w] }
 set l [split [read [set f [open $file]]][close $f] \n]
 if {[lsearch $l *|$n|*] != -1} {
  puthelp "notice $nick :$n is already added to my banrequests."
 } {
  lappend l "$nick|$n|$w|$c|[ctime [unixtime]]"
  set f [open $file w]
  foreach le $l {
   if {$le != ""} { puts $f $le }
  }
  close $f
  puthelp "notice $nick :Added $n to my banrequests."
 }
}

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
kmail
Voice


Joined: 04 May 2006
Posts: 8

PostPosted: Sun May 07, 2006 2:29 pm    Post subject: Reply with quote

Thank you Sir_Fz, the script seems to work just fine but would it be really hard to make it add these lines to a certain mySQL table?
The point is I just realized that it's very goddamn hard to edit a text file through PHP Sad
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