summaryrefslogtreecommitdiff
path: root/src/gizmo/wasp-friend-journalism.el
diff options
context:
space:
mode:
Diffstat (limited to 'src/gizmo/wasp-friend-journalism.el')
-rw-r--r--src/gizmo/wasp-friend-journalism.el45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/gizmo/wasp-friend-journalism.el b/src/gizmo/wasp-friend-journalism.el
new file mode 100644
index 00000000..25d18bdb
--- /dev/null
+++ b/src/gizmo/wasp-friend-journalism.el
@@ -0,0 +1,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