| View previous topic :: View next topic |
| Author |
Message |
Football Master
Joined: 26 Dec 2008 Posts: 205 Location: Quakenet, #Football
|
Posted: Mon Feb 23, 2009 1:11 pm Post subject: Help script |
|
|
| Couldn't find in the archieve here a script that when you type !Help it plays a help file which you can configure.. |
|
| Back to top |
|
 |
starpossen Op
Joined: 10 Jan 2006 Posts: 139
|
Posted: Mon Feb 23, 2009 1:22 pm Post subject: |
|
|
Something like:
| Code: |
bind pub - !help pub:help
proc pub:help {nick uhost hand chan arg} {
set chan [string tolower $chan]
putserv "NOTICE $nick :Hello this is a help text"
}
|
This will notic the one typing, instead of posting in the chanel.
Very simple, but i'm sure someone can make a better one
as i'm no pro at .tcl scripting.
*EDIT gah, didn't see you wanted it to read from a file
which mine doesn't. |
|
| Back to top |
|
 |
Nimos Halfop
Joined: 20 Apr 2008 Posts: 80
|
Posted: Tue Feb 24, 2009 4:19 pm Post subject: |
|
|
| Code: |
###
# Help script
###
#
###
# Config
###
#
##
# Helpfile:
set helpfile(file) "omfg_its_a_helpfile.txt"
##
#
##
# Output Target (private=0 channel=1)
set helpfile(target) 0
##
#
##
# Output Method (either "PRIVMSG" or "NOTICE")
set helpfile(method) "NOTICE"
##
#
###
# End of Config
###
bind pub !help pub:help
proc pub:help {nick host hand chan text} {
global helpfile
set fp [open $helpfile(file) r]
set data [split [read -nonewline $fp] "\n"]
close $fp
if {$helpfile(target) == 1} {
set target $chan
} else {
set target $nick
}
foreach line $data {
puthelp "$helpfile(method) $target :$line"
}
}
putlog "Helpfile Reader loaded with file $my_helpfile" |
I wrote it in the forums textbox, so its not well formatted, but it should work.
The bot will output every line of the file in its own message, example:
Helpfile:
"Commands:
!help - Shows this text
!kickall - Kicks all users"
Channel:
<User> !help
<Bot> Commands:
<Bot> !help - Shows this text
<Bot> !kickall - Kicks all users |
|
| Back to top |
|
 |
|