forked from cadence/out-of-your-element
		
	PK d->m replies are now native Matrix replies
This commit is contained in:
		
							parent
							
								
									98477dc0f6
								
							
						
					
					
						commit
						69922c4a14
					
				
					 1 changed files with 9 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -252,6 +252,15 @@ async function messageToEvent(message, guild, options = {}, di) {
 | 
			
		|||
		if (row) {
 | 
			
		||||
			repliedToEventRow = row
 | 
			
		||||
		}
 | 
			
		||||
	} else if (dUtils.isWebhookMessage(message) && message.embeds[0]?.author?.name?.endsWith("↩️") && message.embeds[0].description?.startsWith("**[Reply to:]")) {
 | 
			
		||||
		const match = message.embeds[0].description.match(/\/channels\/[0-9]*\/[0-9]*\/([0-9]{2,})/)
 | 
			
		||||
		if (match) {
 | 
			
		||||
			const row = from("event_message").join("message_channel", "message_id").join("channel_room", "channel_id").select("event_id", "room_id", "source").and("WHERE message_id = ? AND part = 0").get(match[1])
 | 
			
		||||
			if (row) {
 | 
			
		||||
				message.embeds.shift()
 | 
			
		||||
				repliedToEventRow = row
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if (repliedToEventRow && repliedToEventRow.source === 0) { // reply was originally from Matrix
 | 
			
		||||
		// Need to figure out who sent that event...
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue