summaryrefslogtreecommitdiff
path: root/src/gizmo/wasp-friend-journalism.el
blob: 25d18bdb5dec1a9d287cb9867b3bccc7a93c5c73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
;;; wasp-friend-journalism --- "friend" writes the newspaper -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:

(require 'dash)
(require 's)
(require 'wasp-friend)
(require 'wasp-newspaper)

(defun w/friend-journalism-input ()
  "Collect an input for \"friend\"'s journalism based on recent activities."
  (s-join
   "\n"
   (cons
    (format "LCOLONQ: %s" (s-trim w/last-stream-transcription))
    (--map
     (format "%s: %s" (car it) (cdr it))
     (reverse (-take 20 w/twitch-chat-history))))))

(defun w/friend-journalism (author headline)
  "Retrieve \"friend\"'s opinion on current events related to HEADLINE.
AUTHOR was a contributing author btw."
  (w/friend-personality
   (s-concat
    "Headline: " headline "\n\n"
    (w/friend-journalism-input))
   (lambda (resp)
     (when resp
       (w/write-chat-event (format "\"friend\" finished writing about: %s" headline))
       (funcall
        (if (= (random 5) 0) #'w/newspaper-screenshot (lambda (k) (funcall k nil)))
        (lambda (img)
          (when img
            (w/write-chat-event "...and the article included some photojournalism"))
          (push
           (w/make-newspaper-article
            :headline headline
            :author (format "\"friend\" and %s" author)
            :content (s-trim resp)
            :image img)
           w/newspaper-todays-articles)))))
    "Given a headline of a newspaper article and a summary of recent user activity, please do your best journalist impression and produce a one paragraph article about the situation that fits the headline."))

(provide 'wasp-friend-journalism)
;;; wasp-friend-journalism.el ends here