blake Master
Joined: 23 Feb 2009 Posts: 201
|
Posted: Thu Jul 14, 2011 9:19 am Post subject: Sending text from a file to a channel |
|
|
Hey
I wrote this some time back with a little help here on the forums i want to change it slightly
Currently I have to type !next line number in pm with the bot id like to get it so I only have to type !next and it will output the next line of text
| Code: | set out_chan "#Trainingroom"
set txt_file "training.txt"
bind msg SA|SA !next next_proc
bind msg SA|SA !back back_proc
proc tr_proc { nick uhost hand arg } {
global out_chan txt_file
set line [lindex [split $arg] 0]
if {$line == ""} {
putserv "PRIVMSG $chan :Usage: !next <line number>"
return
}
set take_me [open $txt_file r]
set take_all [split [read $take_me] "\n"]
close $take_me
set data [lindex $take_all [expr $line - 1]]
putquick "PRIVMSG $out_chan :$data"
}
proc back_proc { nick uhost hand arg } {
global out_chan txt_file
set line [lindex [split $arg] 0]
if {$line == ""} {
putserv "PRIVMSG $chan :Usage: !back <line number>"
return
}
set take_me [open $txt_file r]
set take_all [split [read $take_me] "\n"]
close $take_me
set data [lindex $take_all [expr $line - 1]]
putquick "PRIVMSG $out_chan :$data"
} |
Many Thanks _________________ Blake
UKEasyHosting UKStormWatch |
|