Git Product home page Git Product logo

Comments (3)

tulir avatar tulir commented on July 17, 2024

Should be doable, involves some browser devtools on twitter.com/messages to find out how twitter sends mentions in messages (it's probably a separate field in the send request body) and then parsing the Matrix HTML similar to https://github.com/mautrix/facebook/blob/master/mautrix_facebook/formatter/from_matrix.py to generate that field

Other direction already happens in https://github.com/mautrix/twitter/blob/master/mautrix_twitter/formatter.py

from twitter.

bdelwood avatar bdelwood commented on July 17, 2024

Mostly notes for myself as I debug this, but it appears what happens when a user is mentioned is

  1. The "text" key has a value that is the plaintext message, including the raw handle of the user, ie @{USER}.

  2. The "entities" object is included in "message" (this also happens for URLs, which are handled correctly), with a "user_mentions" key containing and array of objects with info on the mentioned user. It appears there is already a class, Message Entities, particularly MessageEntityUserMention, that already has the json object that twitter expects is included in the entity.

I'll check out what the formatter is doing to the value of "text" and "user_mentions." Currently it appears the formatter is only sending the full Matrix username in the "text" field, and not including the expected "entities" key.

from twitter.

tulir avatar tulir commented on July 17, 2024

There's currently no formatter in the Matrix -> Twitter direction, the bridge just sends the plain body.

from twitter.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.