41 lines
1.3 KiB
Racket
41 lines
1.3 KiB
Racket
#lang racket
|
|
|
|
(require "mastodon.rkt"
|
|
"configuration.rkt"
|
|
racket/date
|
|
json)
|
|
|
|
; Seed the RNG
|
|
(random-seed (current-seconds))
|
|
|
|
(define islands-directory "static/islands/")
|
|
(define island-link-base "http://feuforeve.fr/DailyIsland?date=")
|
|
|
|
; Today's date in string
|
|
(define today
|
|
(parameterize ((date-display-format 'iso-8601))
|
|
(date->string
|
|
(seconds->date (current-seconds)))))
|
|
|
|
; Send to mastodon
|
|
; Two images are uploaded with the status
|
|
(let* ((client (new mastodon-client% [instance daily-island:mastodon-instance] [authorization-bearer daily-island:mastodon-authorization-bearer]))
|
|
(media-alt-riv-cit (send client upload-media (string-append islands-directory today "/altitude+rivers+cities.png") "image/png"))
|
|
(media-blk-ter-cit (send client upload-media (string-append islands-directory today "/blank+territories+cities.png") "image/png"))
|
|
)
|
|
(display media-alt-riv-cit)(newline)
|
|
(display media-blk-ter-cit)(newline)
|
|
(display
|
|
(send client
|
|
new-status
|
|
(string-append
|
|
"Today's Island:\n"
|
|
island-link-base today
|
|
"\n\n")
|
|
#:visibility "public"
|
|
#:media-ids (list
|
|
(hash-ref media-alt-riv-cit 'id)
|
|
(hash-ref media-blk-ter-cit 'id)
|
|
))))
|
|
(newline)
|