I have a bot that stores quotes in a file called quotes.txt. When a user types !qfind <text>, I want it to look through the quotes.txt and message quote with <text> . The code below works, but it only returns the first quote with the <text> and then stops. How would I make it search through the entire file and, if there are multiple quotes, message the line numbers of those quotes?
if ($1 == !quotefind) || ($1 == !qfind) {
if (!$2) { msg $chan Insufficient parameters. Syntax: $1 <matchword> | return }
if ($read(quotes.txt,nw,* $+ $2- $+ *)) {
tokenize 92 $v1
.msg $chan 04 $+ $chr(91) Quote $1 $chr(93) $+ $2
.msg $chan 4Submitted by12: $3 4Rated12: $4
}
else {
.notice $nick $qt($2-) was not found in the quote database.
}
}