epimorphism addc4d246f add requirements | преди 5 години | |
---|---|---|
tapris | преди 5 години | |
LICENSE | преди 5 години | |
README.md | преди 5 години | |
example.scm | преди 5 години | |
nodeinfo.scm | преди 5 години | |
rmsrss.scm | преди 5 години |
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