m->d move reply message preview to own line
This commit is contained in:
		| @@ -61,10 +61,10 @@ module.exports = { | |||||||
| 			formatted_body: "\u26a0 <strong>Bridged event from Discord not delivered</strong>" | 			formatted_body: "\u26a0 <strong>Bridged event from Discord not delivered</strong>" | ||||||
| 				+ `<br>Gateway event: ${gatewayMessage.t}` | 				+ `<br>Gateway event: ${gatewayMessage.t}` | ||||||
| 				+ `<br>${e.toString()}` | 				+ `<br>${e.toString()}` | ||||||
| 				+ `<details><summary>Error trace</summary>` | 				+ `<div><details><summary>Error trace</summary>` | ||||||
| 				+ `<pre>${stackLines.join("\n")}</pre></details>` | 				+ `<pre>${stackLines.join("\n")}</pre></details></div>` | ||||||
| 				+ `<details><summary>Original payload</summary>` | 				+ `<div><details><summary>Original payload</summary>` | ||||||
| 				+ `<pre>${util.inspect(gatewayMessage.d, false, 4, false)}</pre></details>`, | 				+ `<pre>${util.inspect(gatewayMessage.d, false, 4, false)}</pre></details></div>`, | ||||||
| 			"m.mentions": { | 			"m.mentions": { | ||||||
| 				user_ids: ["@cadence:cadence.moe"] | 				user_ids: ["@cadence:cadence.moe"] | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -173,9 +173,9 @@ async function eventToMessage(event, guild, di) { | |||||||
| 				replyLine += `Ⓜ️**${senderName}**: ` | 				replyLine += `Ⓜ️**${senderName}**: ` | ||||||
| 			} | 			} | ||||||
| 			const repliedToContent = repliedToEvent.content.formatted_body || repliedToEvent.content.body | 			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] | 			const contentPreview = contentPreviewChunks.length > 1 ? contentPreviewChunks[0] + "..." : contentPreviewChunks[0] | ||||||
| 			replyLine += contentPreview + "\n" | 			replyLine = `> ${replyLine}\n> ${contentPreview}\n` | ||||||
| 		})() | 		})() | ||||||
|  |  | ||||||
| 		// Handling mentions of Discord users | 		// Handling mentions of Discord users | ||||||
|   | |||||||
| @@ -40,10 +40,10 @@ function guard(type, fn) { | |||||||
| 				formatted_body: "\u26a0 <strong>Matrix event not delivered to Discord</strong>" | 				formatted_body: "\u26a0 <strong>Matrix event not delivered to Discord</strong>" | ||||||
| 					+ `<br>Event type: ${type}` | 					+ `<br>Event type: ${type}` | ||||||
| 					+ `<br>${e.toString()}` | 					+ `<br>${e.toString()}` | ||||||
| 					+ `<details><summary>Error trace</summary>` | 					+ `<div><details><summary>Error trace</summary>` | ||||||
| 					+ `<pre>${stackLines.join("\n")}</pre></details>` | 					+ `<pre>${stackLines.join("\n")}</pre></details></div>` | ||||||
| 					+ `<details><summary>Original payload</summary>` | 					+ `<div><details><summary>Original payload</summary>` | ||||||
| 					+ `<pre>${util.inspect(event, false, 4, false)}</pre></details>`, | 					+ `<pre>${util.inspect(event, false, 4, false)}</pre></details></div>`, | ||||||
| 				"m.mentions": { | 				"m.mentions": { | ||||||
| 					user_ids: ["@cadence:cadence.moe"] | 					user_ids: ["@cadence:cadence.moe"] | ||||||
| 				} | 				} | ||||||
|   | |||||||
							
								
								
									
										22
									
								
								notes.md
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								notes.md
									
									
									
									
									
								
							| @@ -1,5 +1,27 @@ | |||||||
| # d2m | # d2m | ||||||
|  |  | ||||||
|  | ## Known issues | ||||||
|  |  | ||||||
|  | - m->d attachments do not work | ||||||
|  | - m->d edits do not work | ||||||
|  | - m->d spoilers do not work | ||||||
|  | - d->m support the rest of the attachments by reading the matrix spec instead of the current approach of whitelisting mime types | ||||||
|  | - d->m emojis do not work at all (inline chat, single emoji size, reactions, bridged state) | ||||||
|  | - m->d code blocks have slightly too much spacing | ||||||
|  | - m->d some reactions don't work because of the variation selector | ||||||
|  | - <--> check whether I implemented deletions | ||||||
|  | - rooms will be set up even if the bridge does not have permission for them, then break when it restarts and tries to reach messages | ||||||
|  | 	- test private threads as part of this | ||||||
|  | 	- solution part 1: calculate the permissions to see if the bot should be able to do stuff | ||||||
|  | 	- solution part 2: attempt a get messages request anyway before bridging a new room, just to make sure! | ||||||
|  | 	- solution part 3: revisit the permissions to add newly available rooms and to close newly inaccessible rooms | ||||||
|  | - consider a way to jump to a timestamp by making up a discord snowflake. practical? helpful? | ||||||
|  | - clean up and write documentation to selfhost | ||||||
|  | - pluralkit considerations for artemis | ||||||
|  | - consider whether to use nested spaces for channel categories and threads | ||||||
|  |  | ||||||
|  | ## Mapping | ||||||
|  |  | ||||||
| Remember that a discord message may be transformed to multiple matrix messages. | Remember that a discord message may be transformed to multiple matrix messages. | ||||||
|  |  | ||||||
| A database will be used to store the discord id to matrix event id mapping. Table columns: | A database will be used to store the discord id to matrix event id mapping. Table columns: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Cadence Ember
					Cadence Ember