Untested - but should work....
on *:TEXT:!add:*:{
/write words.txt $nick said, $2-
}
on *:TEXT:!read:*:{
if ($2 !== $null) {
/msg $nick $read(words.txt)
}
else {
/msg $nick $read(words.txt, s, $2)
}
Usage:
!add Text to add
!read - reads a random line
!read <nick> - searchs for a line that $nick said.
}