mautrix / slack

A Matrix-Slack puppeting bridge
GNU Affero General Public License v3.0
68 stars 19 forks source link

Support message attachments legacy fields #39

Closed twouters closed 8 months ago

twouters commented 1 year ago

As documented at https://api.slack.com/reference/messaging/attachments

Some bots that are used at my employer use the legacy attachments formatting instead of blocks so I hacked this in.
This should probably be a separate function and could be refactored to reduce some nesting, but this is what I'm running right now.

The current version is missing support for the following items because I haven't got around to handle images inside messages but it shouldn't be too hard to implement by refactoring renderImageBlock a bit:

Not sure if this warrants a draft to wait until images are handled or if this can be added as is (after review).

twouters commented 1 year ago

forgot to mention that the code doesn't take the mrkdwn_in field into account, because Slack does parse some stuff like custom emoji even though the fields aren't mentioned in mrkdwn_in