Merge pull request #4 from BenLubar/content-warning

Add support for content warnings on posts.
This commit is contained in:
Lynne 2018-12-05 12:55:05 +10:00 committed by GitHub
commit 5d7fe7a80c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -1 +1 @@
{"site":"https://botsin.space"}
{"site":"https://botsin.space","cw":null}

4
gen.py
View file

@ -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":

View file

@ -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()