From 5d65461d3da8275d796e5159c3f9ae4027bc7f88 Mon Sep 17 00:00:00 2001 From: cage Date: Sun, 28 Nov 2021 12:02:42 +0100 Subject: [PATCH] - added script: 'import-following.lisp'. --- scripts/import-following.lisp | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 scripts/import-following.lisp diff --git a/scripts/import-following.lisp b/scripts/import-following.lisp new file mode 100644 index 0000000..191b468 --- /dev/null +++ b/scripts/import-following.lisp @@ -0,0 +1,48 @@ +;; follow a list of users +;; Copyright © 2021 cage + +;; This program is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;; usage: + +;; after configuring tinmop (https://www.autistici.org/interzona/tinmop.html) +;; tinmop -e get-following.lisp < follows-file +;; the file must be in the format +;; account name newline +;; account name 2 newline +;; account name 3 newline +;; etc. + +(in-package :scripts) + +(defun connect () + (client:init) + (client:authorize)) + +(defun main () + (connect) + (db-utils:with-ready-database (:connect t) + (loop for line = (read-line *standard-input* nil nil nil) + while line do + (let* ((text-utils:*blanks* (append *blanks* '(#\"))) + (name (text-utils:trim-blanks line)) + (id (program-events::find-user-id-from-exact-acct name))) + (if id + (progn + (format t "following: ~a…" name) + (finish-output) + (api-client:follow-user id) + (format t "Done.~%")) + (format *error-output* "User ~s not found~%" name)))))) +(main)