| View previous topic :: View next topic |
| Author |
Message |
rpope904 Voice
Joined: 02 Feb 2008 Posts: 16
|
Posted: Mon Feb 11, 2008 4:29 pm Post subject: Text files, or ideas? |
|
|
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. :) |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Mon Feb 11, 2008 6:34 pm Post subject: |
|
|
| Your company don't pay programmers? |
|
| Back to top |
|
 |
rpope904 Voice
Joined: 02 Feb 2008 Posts: 16
|
Posted: Mon Feb 11, 2008 8:43 pm Post subject: |
|
|
| its a free webhost, so I doubt they make much from it.. I do it just to pass time. |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Feb 12, 2008 1:30 pm Post subject: |
|
|
@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: | 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, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
rpope904 Voice
Joined: 02 Feb 2008 Posts: 16
|
Posted: Tue Feb 12, 2008 4:23 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Tue Feb 12, 2008 4:29 pm Post subject: |
|
|
| nml375 wrote: | @rosc:
I fail to see the relevance of your comment...
|
Just the point of asking for free work for a commercial enterprise.. |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Feb 12, 2008 5:17 pm Post subject: |
|
|
@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, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
|