on *:LOAD: { guser owner $$?"Enter the bot's owner" }
on $*:TEXT:/^[!](quote?)/Si:#marcusraven86:{
if ((%floodjquote) || ($($+(%,floodjquote.,$nick),2))) { return }
set -u120 %floodjquote On
set -u120 %floodjquote. $+ $nick On
if ($2) {
if ($2 !isnum) { msg $chan /me > $+ $2 isn't a number. | halt }
if ($2 isnum) {
if ($read(Quotes.txt,$2)) {
msg $chan /me > Quote #$2 - $read(Quotes.txt,$2)
}
else {
msg $chan /me > No quote on line $2 $+
}
}
}
else {
var %x $rand(1,$lines(Quotes.txt))
msg $chan /me > Quote #( $+ %x $+ ) - $read(Quotes.txt,%x)
}
}
on $*:TEXT:/^[!](t(otal)?quotes)$/Si:#marcusraven86:{ msg $chan /me > Total Quotes: $lines(Quotes.txt) }
on $*:TEXT:/^[!](s(earch)?quotes)/Si:#marcusraven86:{
if (!$2) {
msg $chan /me > Enter a search term!
}
else {
msg $chan /me > Searching through quotes for $2 $+ ...
var %search
var %x 1
while ($read(Quotes.txt,%x)) {
if ($2 isin $read(Quotes.txt,%x)) { var %search $addtok(%search,%x,32) }
inc %x
}
if (!%search) { .timer 1 2 msg $chan /me > No quotes found matchng $2 $+ }
else { .timer 1 2 msg $chan /me > Found quotes matching $2 $+ : %search }
}
}
on $*:TEXT:/^[!](l(ast)?quote)$/Si:#marcusraven86:{ msg $chan /me > Last Quote( $+ $lines(Quotes.txt) $+ ): $read(Quotes.txt,$lines(Quotes.txt)) }
on $*:TEXT:/^[!](a(dd)?quote)/Si:#marcusraven86:{
if (!$2) { msg $iif($chan,$chan,$nick) /me > Enter a quote to add! }
else {
if ($nick isop #) {
write Quotes.txt $2-
msg $iif($chan,$chan,$nick) /me > Added quote - $2- $+
}
}
}
on owner:TEXT:!*:#marcusraven86: {
if ($1 == !delquote) {
if (!$2) { msg $chan Enter a quote number to delete! | return }
if ($2 !isnum) { msg $chan /me > $2 is not a number! | return }
if (!$read(quotes.txt),$2) { msg $chan /me > $2 quote cannot be found! | return }
msg $chan /me > Deleted $2 from quotes.
write -dl $+ $2 Quotes.txt
}
if ($1 == !clearquote) {
if (!$lines(quotes.txt)) { msg $chan /me > Quotes are currently empty! | return }
msg $chan /me > Cleared all $lines(Quotes.txt) quotes.
write -c Quotes.txt
}
}