What is this?
Another, but working, simple (!)learn and (!)say bot. This was made by request for a friend of mine.
Commands
As a user:-
[!@]say <topic> - returns topic's data [!@
]learn - adds topic & data to bot
As the bot:-
/remsay - remove a "say" topic
/saylist [-o] - echo say list location, -o switch opens the file
; say/learn bot
; by jonesy44
; /remsay - remove a say
; /saylist [-o] - echo say list location, -o switch opens the file.
on $*:text:/^[!`@](say|learn)\s?(.*)$/Si:#: {
var %key = $gettok($regml(2),1,32), %dt = $gettok($regml(2),2-,32)
if $regml(1) == say {
if (!%key) { var %y = $r(1,$lines(say.dat)) | msg # $+(,%y,/,$lines(say.dat),) $+(,$gettok($read(say.dat,%y),1,32),) - $gettok($read(say.dat,%y),2-,32) }
elseif ($read(say.dat,s,%key)) msg # $+(,%key,) - $v1
else msg # Nothing saved for $+(,%key,)
}
elseif $regml(1) == learn {
if (!$read(say.dat,s,%key)) { write say.dat %key %dt | msg # Data for $+(,%key,) has been saved as $qt(%dt) }
else msg # Data for $+(,%key,) already exists
}
}
alias remsay {
var %r = $$input(Data topic to be removed,eq,Remove Say Data)
if ($read(say.dat,s,%r)) { write $+(-ds,%r) say.dat | noop $input(Data removed,oi,Remove Say Data) }
else noop $input(No data found for $qt(%r),wo,Remove Say Data)
}
alias saylist $iif($1 == -o,run,echo -a) $+($mircdir,say.dat)