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.

Text files, or ideas?

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
r
rpope904
Voice
Posts: 16
Joined: Sat Feb 02, 2008 7:41 pm

Text files, or ideas?

Post by rpope904 »

Basically, the eggdrop is used in a web hosting support channel, our ops are all staff members of the company, I need a script to kind of record when someone helps a user, as they have requirements to be met every week.. I need to somehow set it up to when a user types !helped <nickname> <explanation> the bot will check if the <nickname> is infact an op in the channel, and then append a text file for that user, in a directory, for this, i'll use /home/rpope904/stafflogs so, say the user typed !helped rpope904 Nameservers help

The bot would write to the file /home/rpope904/stafflogs/rpope904.txt:
<Helped users nick> was helped with NameServers Help on DATE / TIME.

Is this possible? Thanks. :)
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

Your company don't pay programmers?
r
rpope904
Voice
Posts: 16
Joined: Sat Feb 02, 2008 7:41 pm

Post by rpope904 »

its a free webhost, so I doubt they make much from it.. I do it just to pass time.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

@rosc:
I fail to see the relevance of your comment...

@rpope904:
Something like this should do the trick, it is untested however, but I believe I've taken most precautions to prevent unauthorized access to the filesystem and sanitize any and all input data. Let me know how it works out..
This script assumes the helping op is added to your eggdrop's user database with op privileges.

Code: Select all

bind pub - "!helped" pub_helped

proc pub_helped {nick host hand chan text} {
 set data [split $text]
 set helper [lindex $data 0]
 if {[validuser [set h_hand [nick2hand $helper $chan]]] && [matchattr $h_hand o|o]} {
  set reason [join [lrange $data 1 end]]
  set fid [open [file join "/home" "rpope904" "stafflogs" [file tail $h_hand]] "WRONLY APPEND CREAT"]
  puts $fid "$nick was helped with $reason on [clock format [clock seconds]]"
  close $fid
 } {
  puthelp "PRIVMSG $nick :The nickname $helper was not recognized as an authorized op. Please check your data and try again."
 }
}
Edit:
Fixed minor typo, "missing close bracket".
NML_375
r
rpope904
Voice
Posts: 16
Joined: Sat Feb 02, 2008 7:41 pm

Post by rpope904 »

Thanks for your help, I got this error with it: I've also tried to find out where it is..:

[14:45] <x10Helper> [14:45] Tcl error [pub_helped]: missing close-bracket
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

nml375 wrote:@rosc:
I fail to see the relevance of your comment...
Just the point of asking for free work for a commercial enterprise..
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

@rpope904:
Error found and corrected, see my previous post.

@rosc:
If you do not feel like writing scripts to a commercial entity, that's your choice. But please refrain from making posts like the one above, as it really isn't helpful to anyone.
NML_375
Post Reply