#lang racket

(require net/url
         "mastodon.rkt"
         "twitter.rkt"
         "configuration.rkt")

; Do an API call to the website
(define arnytron-generator (string-append feuforeve:website "/ArnYtron3000/brut"))
(define quote (port->string (get-pure-port (string->url arnytron-generator))))

; Send to mastodon
(display
  (send
    (new mastodon-client%
         [instance arnytron:mastodon-instance]
         [authorization-bearer arnytron:mastodon-authorization-bearer])
    new-status
    quote
    #:visibility "unlisted"))
(newline)

; Publication on Twitter
(display
  (send
    (new twitter-client%
         [consumer-key arnytron:twitter-consumer-key]
         [consumer-secret arnytron:twitter-consumer-secret]
         [access-key arnytron:twitter-access-token]
         [access-secret arnytron:twitter-access-token-secret])
    status-update
    quote))
(newline)
