Don't choke when the status fails to send
This commit is contained in:
		
							parent
							
								
									979956d347
								
							
						
					
					
						commit
						bcf2ad4ba1
					
				| 
						 | 
					@ -239,8 +239,14 @@ async def listen(c, me):
 | 
				
			||||||
				reply_text = f'{status_author} Sorry! You broke me somehow. Please let Holly know what you did!'
 | 
									reply_text = f'{status_author} Sorry! You broke me somehow. Please let Holly know what you did!'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			log('Sending reply...')
 | 
								log('Sending reply...')
 | 
				
			||||||
 | 
								try:
 | 
				
			||||||
				reply = await c.create_status(status=reply_text, media_ids=media_ids, in_reply_to_id=status_id, visibility=reply_visibility)
 | 
									reply = await c.create_status(status=reply_text, media_ids=media_ids, in_reply_to_id=status_id, visibility=reply_visibility)
 | 
				
			||||||
				log(f'Reply sent! {reply["uri"]}')
 | 
									log(f'Reply sent! {reply["uri"]}')
 | 
				
			||||||
 | 
								except atoot.api.UnprocessedError as e:
 | 
				
			||||||
 | 
									log(f'Could not send reply!', Severity.ERROR)
 | 
				
			||||||
 | 
									log(traceback.format_exc(), Severity.ERROR)
 | 
				
			||||||
 | 
									error_msg = 'An error occured sending the reply. This most likely means that it would have been greater than 500 characters. If it was something else, please let Holly know!'
 | 
				
			||||||
 | 
									await c.create_status(status=f'{status_author} {error_msg}', in_reply_to_id=status_id, visibility=reply_visibility)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# https://stackoverflow.com/a/55505152/2114129
 | 
					# https://stackoverflow.com/a/55505152/2114129
 | 
				
			||||||
async def repeat(interval, func, *args, **kwargs):
 | 
					async def repeat(interval, func, *args, **kwargs):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue