tapris being a Pleroma bot

epimorphism addc4d246f add requirements 5 年之前
tapris ed26f43e8c add support for content_type for `post-status' 5 年之前
LICENSE 373f1fa1bb add GPL 5 年之前
README.md addc4d246f add requirements 5 年之前
example.scm ceec6f88ba add an example 5 年之前
nodeinfo.scm 2b93c99b58 [nodeinfo]: add enabled formats 5 年之前
rmsrss.scm d1d3b7b880 [rmsrss]: initial import 5 年之前

README.md

Tapris, will eventually be a powerful Pleromer bot UwU

THIS IS HEAVY WIP

REQUIREMENTS

  • Guile >= 2.2
  • GNU TLS
  • guile-json

USAGE

You can include the modules with (use-modules (tapris client)) (make sure to have the directory with client.scm in your GUILE_LOAD_PATH.

The basic work-flow is as follows:

1) Obtain a client by using (register-app).

(use-modules
 (ice-9 format)
 (srfi srfi-1)
 (web uri)
 (tapris client))

(define instance (string->uri "https://letsalllovela.in"))

(define client (register-app instance))

2) Obtain an authorization code by asking the user to visit the url obtained from build-authorize-url. This authorization code can only be used once.

(define (ask-for-code client)
  (let ((u (build-authorize-url client)))
    (format #t "Please visit the following URL to obtain the \
authorization code: ~a\n" (uri->string u))))

(ask-for-code client)
;; obtain the AUTH_CODE here

3) Obtain an access token with get-token using the authorization code. Store this token somewhere in order to reuse it.

(define token (get-token client AUTH_CODE))
(display token) (newline)
(set-client-token! client token)

4) Optionally, verify the token with verify-credentials.

(verify-credentials client)
;; examine the output

5) You can shitpost now!

(post-media client "/home/lain/swimsuit.jpg" #:status "ayyuwu")

INFO

The code here is heavily based on guile-mastodon by Pierre-Antoine Rouby. I didn't manage to get it work well, and didn't like the API that much, so I just copied some of the parts that I need. But big time kudos for the define-json-reader macro that I took almost verbatim.

Contact: epi@disroot.org