Merge pull request #4 from BenLubar/content-warning
Add support for content warnings on posts.
This commit is contained in:
		
						commit
						5d7fe7a80c
					
				| 
						 | 
					@ -1 +1 @@
 | 
				
			||||||
{"site":"https://botsin.space"}
 | 
					{"site":"https://botsin.space","cw":null}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										4
									
								
								gen.py
								
								
								
								
							
							
						
						
									
										4
									
								
								gen.py
								
								
								
								
							| 
						 | 
					@ -30,9 +30,9 @@ if __name__ == '__main__':
 | 
				
			||||||
			if toot['media'] != None:
 | 
								if toot['media'] != None:
 | 
				
			||||||
				mediaID = client.media_post(toot['media'], description = toot['toot'])
 | 
									mediaID = client.media_post(toot['media'], description = toot['toot'])
 | 
				
			||||||
				client.status_post(toot['toot'].replace("\n", " "),
 | 
									client.status_post(toot['toot'].replace("\n", " "),
 | 
				
			||||||
					media_ids = [mediaID], visibility = "unlisted")
 | 
										media_ids = [mediaID], visibility = "unlisted", spoiler_text = cfg['cw'])
 | 
				
			||||||
			else:
 | 
								else:
 | 
				
			||||||
				client.status_post(toot['toot'], visibility = 'unlisted')
 | 
									client.status_post(toot['toot'], visibility = 'unlisted', spoiler_text = cfg['cw'])
 | 
				
			||||||
		except Exception as err:
 | 
							except Exception as err:
 | 
				
			||||||
			toot = {
 | 
								toot = {
 | 
				
			||||||
			"toot":
 | 
								"toot":
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								reply.py
								
								
								
								
							
							
						
						
									
										2
									
								
								reply.py
								
								
								
								
							| 
						 | 
					@ -49,7 +49,7 @@ class ReplyListener(mastodon.StreamListener):
 | 
				
			||||||
			visibility = notification['status']['visibility']
 | 
								visibility = notification['status']['visibility']
 | 
				
			||||||
			if visibility == "public":
 | 
								if visibility == "public":
 | 
				
			||||||
				visibility = "unlisted"
 | 
									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)
 | 
								print("replied with " + toot)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
rl = ReplyListener()
 | 
					rl = ReplyListener()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in New Issue