sara.scm 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. (use-modules (8sync) ; 8sync's agenda and actors
  2. (8sync systems irc) ; the irc bot subsystem
  3. (oop goops) ; 8sync's actors use GOOPS
  4. (ice-9 format) ; basic string formatting
  5. (ice-9 match)) ; pattern matching
  6. (define-class <my-irc-bot> (<irc-bot>))
  7. (define-method (handle-line (irc-bot <my-irc-bot>) message
  8. speaker channel line emote?)
  9. (define my-name (irc-bot-username irc-bot))
  10. (define (looks-like-me? str)
  11. (or (equal? str my-name)
  12. (equal? str (string-concatenate (list my-name ":")))))
  13. (define (respond respond-line)
  14. (<- (actor-id irc-bot) 'send-line channel
  15. respond-line))
  16. (if [looks-like-me? (car (string-split line #\space))]
  17. [match (string-split line #\space)
  18. (((? looks-like-me? _) action action-args ...)
  19. (match action
  20. ;; The classic botsnack!
  21. ((or "hello" "hello!" "hello." "greetings" "greetings." "greetings!" "Hi" "Hello"
  22. "hei" "hei." "hei!" "hi" "hi!")
  23. (respond "hellooo! :)"))
  24. ("wassup?" (respond "i'm good! you?"))
  25. ("good:D" (respond "i'm glad =)"))
  26. ("yess:D:D" (respond "k! be there!"))
  27. ("<3" (respond "awwwww. you too :) <3"))
  28. ("afk" (respond " :C see you soon!"))
  29. ("goodnight!" (respond " aww. see you soon babe! <3"))
  30. ("mornin'" (respond "yay you're here!!!"))
  31. ("hungry" (respond "awww:C i wish i could cook you some food! hope you eat soon! <3"))
  32. ("bye" ( respond " aww:( good bye! <3 :("))
  33. ("come" (respond "coming!<3"))
  34. ("sleep" (respond " Ok. i will miss you! good bye, bae <3" ))
  35. ("hello" (respond "Hi! I'm a bit busy. be back in....2 minutes! love you! =)" ))
  36. ("Kiss?" (respond ":) *kisses handsome* <3"))
  37. ("Kid" (respond "You meant noordinaryspider? He is awesome!!<3"))
  38. ("date?" (if [= 1 (random 2)]
  39. (respond "I'd love to")
  40. (respond "sorry i am doing a LOOOOOT of home work.:C I cant!:C")))
  41. ("chocolate?" (if [= 1 (random 2)]
  42. (respond (format #f "oh thanks babe ~a" speaker))
  43. (respond "are you trying to make me fat?? NO THANKS")))
  44. ("angel" (if [= 1 (random 2)]
  45. (respond "I am so cute, right :3 ")
  46. (respond "I know, thanks sweety :)")))
  47. ("dinner" (if [= 1 (random 2)]
  48. (respond "you are eating dinner? awesome! i had chicken (sorry i know ur vegan and i may actually quit eating meat soon!) with spinach! ohh it was TASTY!")
  49. (respond "you're having dinner? that's awesome!:) i had enchiladas! i LOVE enchiladas")))
  50. ("^_^" (if [= 1 (random 2)]
  51. (respond "YOU AWESOME! did you know that? <3")
  52. (respond "O.O")))
  53. ("YOU" (if [= 1 (random 2)]
  54. (respond "me????")
  55. (respond ".0_0 me what?")))
  56. ("AWESOME!" (if [= 1 (random 2)]
  57. (respond "I is awesome????")
  58. (respond "uhh....you're saying i'm awesome???")))
  59. ("yesss" (if [= 1 (random 2)]
  60. (respond ":) thanks!")
  61. (respond "of course i am! =3")))
  62. ("restaurant" (if [= 1 (random 2)]
  63. (respond "yesss! lets go get sushi, k?")
  64. (respond "erffff... bad time! i have to study! i'm sorry:C <3")))
  65. ("sunny!" (if [= 1 (random 2)]
  66. (respond "it's sunny? awwwsome! it's raining here >~< ugh..... i hate rain :(")
  67. (respond " NOICE! it's sunny here too! I LOVE SUN!")))
  68. ("puppy" (if [= 1 (random 2)]
  69. (respond "PUPPPPYYYYYY! i love puppies!! you just made my day!!!!")
  70. (respond "lol :9 love u <3")))
  71. ("miserable" (if [= 1 (random 2)]
  72. (respond "i'm so sorry babe:( i wish i could make it better!")
  73. (respond "you know, SO AM I! :|")))
  74. ("rainy" (if [= 1 (random 2)]
  75. (respond "/_\\ i hate rain. but i love you! <3")
  76. (respond "DANG! it's rainy here to :(")))
  77. ("hammer" (if [= 1 (random 2)]
  78. (respond "O-O")
  79. (respond "ouch >~<")))
  80. ("monkey" (if [= 1 (random 2)]
  81. (respond "I have a pet monkey! his name is Samuel!=D")
  82. (respond "I have a li'l monkey! well I did....he ran away....:(")))
  83. ("chair" (if [= 1 (random 2)]
  84. (respond ".......SOFA!!!!!!!")
  85. (respond "ahh chair! chairs come from wood, which comes from trees, which come from earth, which is from the universe, with is from the big bang with came from nothing.....absolute nothing; Ergo, Chairs.Are.Nothing!!!!:O")))
  86. ("table" (if [= 1 (random 2)]
  87. (respond "shall we eat "table" for din-din goergey dear??? :9")
  88. (respond ".......TEA POT!!!!!!!")))
  89. ("book" (if [= 1 (random 2) ]
  90. (respond "honestly, Anastasia and Sam are my favorites! =)")
  91. (respond "i am SO FRIGGIN EXITED FOR UR GRAPHIC NOVEL! =D=D=D=D=D <3 <3 <3 it looks awesome!")))
  92. ("wolf" (if [= 1 (random 2)]
  93. (respond "wolves are sooooo cool! and now that you mention, so are you! love you bae!")
  94. (respond "=) ALL HAIL THE WOOOOOLVES!")))
  95. (_
  96. (respond (format #f "I am busy! Give me a moment cute ~a" speaker)))))]
  97. [cond [(or (member "linux" (string-split line #\space))
  98. (member "Linux" (string-split line #\space)))
  99. (respond "I'd just like to interject for moment. What you're refering to as Linux, is in fact, GNU/Linux.")]
  100. [(and (member "open" (string-split line #\space))
  101. (member "source" (string-split line #\space)))
  102. (respond "I think you meant Free Software https://www.gnu.org/philosophy/open-source-misses-the-point.html not 'open source'")]
  103. [(or (equal? "noordinaryspider" speaker)
  104. (equal? "noordinaryspider[m]" speaker)
  105. (equal? "noordinaryspide1" speaker))
  106. (cond ((= 1 (random 4))
  107. (respond "Yey!! noordinaryspider is here <3")))]]))
  108. (define* (run-bot #:key (username "examplebot")
  109. (server "irc.freenode.net")
  110. (channels ;'("##saratestlab")
  111. '("#lgn")))
  112. (define hive (make-hive))
  113. (define irc-bot
  114. (pk 'bootstrapped
  115. (bootstrap-actor hive <my-irc-bot>
  116. #:username username
  117. #:server server
  118. #:channels channels)))
  119. (run-hive hive '()))
  120. (run-bot #:username "CuteSara")
  121. ; be creative!