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 

Text files, or ideas?

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


Joined: 02 Feb 2008
Posts: 16

PostPosted: Mon Feb 11, 2008 4:29 pm    Post subject: Text files, or ideas? Reply with quote

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
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Mon Feb 11, 2008 6:34 pm    Post subject: Reply with quote

Your company don't pay programmers?
Back to top
View user's profile Send private message
rpope904
Voice


Joined: 02 Feb 2008
Posts: 16

PostPosted: Mon Feb 11, 2008 8:43 pm    Post subject: Reply with quote

its a free webhost, so I doubt they make much from it.. I do it just to pass time.
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Tue Feb 12, 2008 1:30 pm    Post subject: Reply with quote

@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
View user's profile Send private message
rpope904
Voice


Joined: 02 Feb 2008
Posts: 16

PostPosted: Tue Feb 12, 2008 4:23 pm    Post subject: Reply with quote

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
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Tue Feb 12, 2008 4:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Tue Feb 12, 2008 5:17 pm    Post subject: Reply with quote

@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
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