epimorphism addc4d246f add requirements | 5 vuotta sitten | |
---|---|---|
tapris | 5 vuotta sitten | |
LICENSE | 5 vuotta sitten | |
README.md | 5 vuotta sitten | |
example.scm | 5 vuotta sitten | |
nodeinfo.scm | 5 vuotta sitten | |
rmsrss.scm | 5 vuotta sitten |
Tapris, will eventually be a powerful Pleromer bot UwU
THIS IS HEAVY WIP
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")
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