removed unused media code
This commit is contained in:
		
							parent
							
								
									0ceb255865
								
							
						
					
					
						commit
						cd659d86a1
					
				| 
						 | 
				
			
			@ -61,10 +61,7 @@ def make_toot_markov(query = None):
 | 
			
		|||
 | 
			
		||||
	if toot == None:
 | 
			
		||||
		toot = "Toot generation failed! Contact Lynne (lynnesbian@fedi.lynnesbian.space) for assistance."
 | 
			
		||||
	return {
 | 
			
		||||
			"toot": toot,
 | 
			
		||||
			"media": None
 | 
			
		||||
		}
 | 
			
		||||
	return toot
 | 
			
		||||
 | 
			
		||||
def extract_toot(toot):
 | 
			
		||||
	toot = html.unescape(toot) #convert HTML escape codes to text
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										15
									
								
								gen.py
								
								
								
								
							
							
						
						
									
										15
									
								
								gen.py
								
								
								
								
							| 
						 | 
				
			
			@ -30,18 +30,11 @@ if __name__ == '__main__':
 | 
			
		|||
		toot = re.sub(r"[\[\]\(\)\{\}\"“”«»„]", "", toot)
 | 
			
		||||
	if not args.simulate:
 | 
			
		||||
		try:
 | 
			
		||||
			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", spoiler_text = cfg['cw'])
 | 
			
		||||
			else:
 | 
			
		||||
				client.status_post(toot['toot'], visibility = 'unlisted', spoiler_text = cfg['cw'])
 | 
			
		||||
			client.status_post(toot['toot'], visibility = 'unlisted', spoiler_text = cfg['cw'])
 | 
			
		||||
		except Exception as err:
 | 
			
		||||
			toot = {
 | 
			
		||||
			"toot": "An error occurred while submitting the generated post. Contact lynnesbian@fedi.lynnesbian.space for assistance."
 | 
			
		||||
			}
 | 
			
		||||
			toot = "An error occurred while submitting the generated post. Contact lynnesbian@fedi.lynnesbian.space for assistance."
 | 
			
		||||
			client.status_post(toot['toot'], visibility = 'unlisted', spoiler_text = "Error!")
 | 
			
		||||
	try:
 | 
			
		||||
		print(toot['toot'])
 | 
			
		||||
		print(toot)
 | 
			
		||||
	except UnicodeEncodeError:
 | 
			
		||||
		print(toot['toot'].encode("ascii", "ignore")) # encode as ASCII, dropping any non-ASCII characters
 | 
			
		||||
		print(toot.encode("ascii", "ignore")) # encode as ASCII, dropping any non-ASCII characters
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								reply.py
								
								
								
								
							
							
						
						
									
										2
									
								
								reply.py
								
								
								
								
							| 
						 | 
				
			
			@ -67,7 +67,7 @@ class ReplyListener(mastodon.StreamListener):
 | 
			
		|||
					else:
 | 
			
		||||
						print("User is not valid")
 | 
			
		||||
			else:
 | 
			
		||||
				toot = functions.make_toot(True)['toot'] #generate a toot
 | 
			
		||||
				toot = functions.make_toot(True) #generate a toot
 | 
			
		||||
				toot = acct + " " + toot #prepend the @
 | 
			
		||||
				print(acct + " says " + mention) #logging
 | 
			
		||||
				visibility = notification['status']['visibility']
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue