on *:text:!*quote*:#:{ quotehandle $1- }
on *:input:*:{ quotehandle $1- }
alias quotehandle {
if $1 == !quote {
var %n = $iif($2 isnum,$2,$rand(1,$lines(quotes.txt)))
msg $chan %n $+ . $read(quotes.txt,%n)
}
if $1 == !addquote && $2 { write quotes.txt $2- | msg $chan Quote added! }
if $1 == !delquote && $2 isnum { write -dl $+ $2 quotes.txt | msg $chan Quote $2 deleted! }
if $1 == !quotes { msg $chan $calc($lines(quotes.txt)) quotes in database! }
if $1 == !quotesearch { msg $chan $iif($read(quotes.txt, w, * $+ $2- $+ *),$ifmatch,No matches) }
}