From 35b5408072ec75ec15f901043140f12c1065bd87 Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Sat, 24 Nov 2018 13:13:02 -0600 Subject: [PATCH] Add support for content warnings on posts. --- config.json | 2 +- gen.py | 4 ++-- reply.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config.json b/config.json index ab4bb6f..1120656 100644 --- a/config.json +++ b/config.json @@ -1 +1 @@ -{"site":"https://botsin.space"} \ No newline at end of file +{"site":"https://botsin.space","cw":null} diff --git a/gen.py b/gen.py index af6e8e3..a07dcce 100755 --- a/gen.py +++ b/gen.py @@ -30,9 +30,9 @@ if __name__ == '__main__': if toot['media'] != None: mediaID = client.media_post(toot['media'], description = toot['toot']) client.status_post(toot['toot'].replace("\n", " "), - media_ids = [mediaID], visibility = "unlisted") + media_ids = [mediaID], visibility = "unlisted", spoiler_text = cfg['cw']) else: - client.status_post(toot['toot'], visibility = 'unlisted') + client.status_post(toot['toot'], visibility = 'unlisted', spoiler_text = cfg['cw']) except Exception as err: toot = { "toot": diff --git a/reply.py b/reply.py index f4845de..36a5c0f 100755 --- a/reply.py +++ b/reply.py @@ -49,7 +49,7 @@ class ReplyListener(mastodon.StreamListener): visibility = notification['status']['visibility'] if visibility == "public": visibility = "unlisted" - client.status_post(toot, post_id, visibility=visibility) + client.status_post(toot, post_id, visibility=visibility, spoiler_text = cfg['cw']) print("replied with " + toot) rl = ReplyListener()