m->d move reply message preview to own line
This commit is contained in:
		
							parent
							
								
									1ed40bb5f4
								
							
						
					
					
						commit
						6a03c96984
					
				
					 4 changed files with 32 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -173,9 +173,9 @@ async function eventToMessage(event, guild, di) {
 | 
			
		|||
				replyLine += `Ⓜ️**${senderName}**: `
 | 
			
		||||
			}
 | 
			
		||||
			const repliedToContent = repliedToEvent.content.formatted_body || repliedToEvent.content.body
 | 
			
		||||
			const contentPreviewChunks = chunk(repliedToContent.replace(/.*<\/mx-reply>/, "").replace(/(?:\n|<br>)+/g, " ").replace(/<[^>]+>/g, ""), 24)
 | 
			
		||||
			const contentPreviewChunks = chunk(repliedToContent.replace(/.*<\/mx-reply>/, "").replace(/(?:\n|<br>)+/g, " ").replace(/<[^>]+>/g, ""), 50)
 | 
			
		||||
			const contentPreview = contentPreviewChunks.length > 1 ? contentPreviewChunks[0] + "..." : contentPreviewChunks[0]
 | 
			
		||||
			replyLine += contentPreview + "\n"
 | 
			
		||||
			replyLine = `> ${replyLine}\n> ${contentPreview}\n`
 | 
			
		||||
		})()
 | 
			
		||||
 | 
			
		||||
		// Handling mentions of Discord users
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,10 +40,10 @@ function guard(type, fn) {
 | 
			
		|||
				formatted_body: "\u26a0 <strong>Matrix event not delivered to Discord</strong>"
 | 
			
		||||
					+ `<br>Event type: ${type}`
 | 
			
		||||
					+ `<br>${e.toString()}`
 | 
			
		||||
					+ `<details><summary>Error trace</summary>`
 | 
			
		||||
					+ `<pre>${stackLines.join("\n")}</pre></details>`
 | 
			
		||||
					+ `<details><summary>Original payload</summary>`
 | 
			
		||||
					+ `<pre>${util.inspect(event, false, 4, false)}</pre></details>`,
 | 
			
		||||
					+ `<div><details><summary>Error trace</summary>`
 | 
			
		||||
					+ `<pre>${stackLines.join("\n")}</pre></details></div>`
 | 
			
		||||
					+ `<div><details><summary>Original payload</summary>`
 | 
			
		||||
					+ `<pre>${util.inspect(event, false, 4, false)}</pre></details></div>`,
 | 
			
		||||
				"m.mentions": {
 | 
			
		||||
					user_ids: ["@cadence:cadence.moe"]
 | 
			
		||||
				}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue