tglogo.png

Downloading File

Filename: Learn & Regurgitate Bot
; 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)



Related Files


Please note that on our website we use cookies necessary for the functioning of our website, cookies that optimize the performance. To learn more about our cookies, how we use them and their benefits, please read our Cookie Policy.
I Understand