script works like this when u type !cw 3 now on the bot will
msg [ RQ3 CW ] #channel is looking for 3vs3 @ now - Server on
and save it to database.txt, when u type !cwlist the bot will read the database.txt and passes the text to the channel. i need somekinda timer to delete the msg from the database when 15min have passed, but i dont wanna delete all messages from there only that 1 line wich you typed 15mins ago. so here is the script. that !remove is only a temporally until i can get that timerthing to work
Code: Select all
# (c) Dragoneye & babou
set chanlist [channels]
set vs "vs"
bind pub - !cw ewa_cw
bind pub - !help ewa_help
bind msg m|m spam ewa_spam
bind pub - !ctb ewa_pcw
bind pub - !cwlist ewa_cwlist
bind pub - !remove ewa_remove
proc ewa_spam { nick uhost handle arg } {
global chanlist
for { set index 0 } { $index<[llength $chanlist] } { incr index } {
puthelp "PRIVMSG [lindex $chanlist $index] :$arg"
}
}
proc ewa_help { nick uhost handle channel arg } {
puthelp "NOTICE $nick : *******Matchfind*******"
puthelp "NOTICE $nick : !cw <number of players> <time> <on/off>"
puthelp "NOTICE $nick : You can do '!CTB' with same use to ask for a Capture the briefcase cw."
puthelp "NOTICE $nick : for example: !cw 4 9pm on"
puthelp "NOTICE $nick : <on/off> is the status of a server. If you can have one do 'on', if not do 'off'."
puthelp "NOTICE $nick : You need to be OP to ask for a cw. If ReactionBot is not on your channel ask it to Dragoneye @ #clan.sup or mail dragon@netikka.fi."
puthelp "NOTICE $nick : *******Teh End**********"
}
proc ewa_cw { nick uhost handle channel arg } {
global chanlist vs
set file datafile.txt
if {![file exists $file]} {close [open $file w]}
set io [open $file w]
if { [isop $nick $channel] } {
set ewa_playernumber [string tolower [lindex $arg 0]]
set ewa_time [lindex $arg 1]
set ewa_server [string tolower [lindex $arg 2]]
if { ( $ewa_playernumber != "" ) && ( $ewa_time !="" ) && ( $ewa_server !="" ) } {
if { $ewa_playernumber == "1" || $ewa_playernumber == "2" || $ewa_playernumber == "3" || $ewa_playernumber == "4" || $ewa_playernumber == "5" || $ewa_playernumber == "6" || $ewa_playernumber == "7" || $ewa_playernumber == "8" } {
if { ( $ewa_server == "on" ) || ( $ewa_server == "off" ) } {
set ewa_status $ewa_server
for { set index 0 } { $index<[llength $chanlist] } { incr index } {
putserv "PRIVMSG [lindex $chanlist $index] :\\[ RQ3 CW \] $channel is looking for $ewa_playernumber$vs$ewa_playernumber @ $ewa_time - Server $ewa_status"
# putserv "PRIVMSG reactionbot3 :spam \[ RQ3 CW \] $channel is looking for $ewa_playernumber$vs$ewa_playernumber @ $ewa_time - Server $ewa_status"
# putserv "PRIVMSG reactionbot2 :spam \[ RQ3 CW \] $channel is looking for $ewa_playernumber$vs$ewa_playernumber @ $ewa_time - Server $ewa_status"
}
puts $io "\[ RQ3 CW ]\ $channel is looking for $ewa_playernumber$vs$ewa_playernumber @ $ewa_time - Server $ewa_status"
close $io
} else {
puthelp "NOTICE $nick : $ewa_server is a bad server status, it must be 'on' or 'off'. Try '!help' for more info."
}
} else {
puthelp "NOTICE $nick : $ewa_playernumber is bad, it's the number of players you want in the cw. It must be set between 1 and 8. Try '!help' for more info."
}
} else {
puthelp "NOTICE $nick : Uh?? What are you trying to say? Do '!help' for more info."
}
} else {
puthelp "NOTICE $nick : You need to be OP to ask for a cw. You need to be OP to ask for a cw. If ReactionBot is not on your channel ask it to Dragoneye @ #clan.sup or mail dragon@netikka.fi."
}
}
proc ewa_pcw { nick uhost handle channel arg } {
global chanlist vs
if { [isop $nick $channel] } {
set ewa_playernumber [string tolower [lindex $arg 0]]
set ewa_time [lindex $arg 1]
set ewa_server [string tolower [lindex $arg 2]]
if { ( $ewa_playernumber != "" ) && ( $ewa_time !="" ) && ( $ewa_server !="" ) } {
if { $ewa_playernumber == "1" || $ewa_playernumber == "2" || $ewa_playernumber == "3" || $ewa_playernumber == "4" || $ewa_playernumber == "5" || $ewa_playernumber == "6" || $ewa_playernumber == "7" || $ewa_playernumber == "8" } {
if { ( $ewa_server == "on" ) || ( $ewa_server == "off" ) } {
set ewa_status $ewa_server
for { set index 0 } { $index<[llength $chanlist] } { incr index } {
putserv "PRIVMSG [lindex $chanlist $index] :\\[ RQ3 CTB \] $channel is looking for $ewa_playernumber$vs$ewa_playernumber @ $ewa_time - Server $ewa_status"
# putserv "PRIVMSG reactionbot3 :spam \[ RQ3 CTB \] $channel is looking for $ewa_playernumber$vs$ewa_playernumber @ $ewa_time - Server $ewa_status"
# putserv "PRIVMSG reactionbot2 :spam \[ RQ3 CTB \] $channel is looking for $ewa_playernumber$vs$ewa_playernumber @ $ewa_time - Server $ewa_status"
}
} else {
puthelp "NOTICE $nick : $ewa_server is a bad server status, it must be 'on' or 'off'. Try '!help' for more info."
}
} else {
puthelp "NOTICE $nick : $ewa_playernumber is bad, it's the number of players you want in the cw. It must be set between 1 and 8. Try '!help' for more info."
}
} else {
puthelp "NOTICE $nick : Uh?? What are you trying to say? Do '!help' for more info."
}
} else {
puthelp "NOTICE $nick : You need to be OP to ask for a cw. You need to be OP to ask for a cw. If ReactionBot is not on your channel ask it to Dragoneye @ #clan.sup or mail dragon@netikka.fi."
}
}
proc ewa_cwlist {nick uhost handle channel arg} {
set file datafile.txt
if {![file exists $file]} {close [open $file w]}
set io [open $file r]
set list ""
while {![eof $io]} {
gets $io line
if {[string trim $line] == ""} {continue}
lappend list $line
}
close $io
set length [llength $list]
set message "$length match[expr {($length == "1")?"":"es"}] found."
putserv "PRIVMSG $channel :$message"
foreach line $list {
putserv "PRIVMSG $channel :$line"
}
}
proc ewa_remove {nick uhost handle channel arg} {
set file datafile.txt
if {![file exists $file]} {close [open $file w]}
set io [open $file r]
set list ""
while {![eof $io]} {
gets $io line
set line [string tolower $line]
if {([string trim $line] == "") ||
($line == [string tolower $arg])} {continue}
lappend list $line
}
close $io
set io [open $file w]
foreach line $list {puts $io $line}
close $io
putserv "PRIVMSG $channel :Removed. $arg"
}