Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable access to content format and formatted_body from within MessageEvent #214

Open
stronk7 opened this issue May 14, 2022 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@stronk7
Copy link

stronk7 commented May 14, 2022

First of all, note that I'm a complete newbie to JS (and more to TS), so maybe there is already a way that I don't know.

In a number of situations it may be interesting to be able to access to the content format and formatted_body attributes from within MessageEvent. In my case, I'm working in a bot that, apart from other utilities will also provide DB logging of configured rooms for later vies/search via web and, whenever available, it would be perfect to have the html information at hand.

Looking to code base, I've seen some uses of them around TextualMessageEventContent model definitions and also when sending using the "html" methods. But I've been unable to access to those attributes, and I've tried all the ways I was able to imagine. So I've had to apply this ugly trick to get access to them:

const anyContent = (message.content as any);
if (anyContent.format) {
    ...
    ...

It would be great if the very same we have the "send as html" methods, we could access to that format and html information when available in incoming messages.

Again, sorry for my ignorance if there is a way to access to that information, I've tried my best, ciao :-)

@turt2live turt2live added the enhancement New feature or request label May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants