GithubHelp home page GithubHelp logo

Comments (8)

SnapdragonLee avatar SnapdragonLee commented on May 17, 2024

If I change chat_id to any other chats, or change type to photo/file no behaviors either.

from td.

levlam avatar levlam commented on May 17, 2024

You can use only identifiers received from TDLib, therefore you must receive the chat_id from TDLib before you can use it.

Additionally, you can check TDLib logs to see requests received by TDLib and their responses.

from td.

SnapdragonLee avatar SnapdragonLee commented on May 17, 2024

You can use only identifiers received from TDLib, therefore you must receive the chat_id from TDLib before you can use it.

Additionally, you can check TDLib logs to see requests received by TDLib and their responses.

Thanks for the reply. From my side, I could see the identifiers in a 10 digits format, and I have handled the json event each time I send to myself on other clients.

For the TDLib, what level of logs should I use? level 2? I may have a try to redirect stdout to a file.

from td.

levlam avatar levlam commented on May 17, 2024

You need level 3 or bigger to see all requests in the log.

from td.

SnapdragonLee avatar SnapdragonLee commented on May 17, 2024

OK, I have do some tests on daemon thread.

time.sleep(3)
    td_send({
        # '@type': 'loadChats',
        # 'limit': 1

        '@type': 'getChat',
        'chat_id': {19xxxxxxxxx}
    })

    time.sleep(3)
    td_send({
        "@type": "sendMessage",
        "chat_id": 19xxxxxxxxx,
        "input_message_content": {
            "@type": "inputMessageText",
            "text": {
                "@type": "formattedText",
                "text": "Hello, this is a test message."
            }
        }
    })

The first one, loadChats and limit set to 1, I could send this message. But for the second, openChat or getChat, the log in severity 3 reports that Chat is not found with a 400 return. Why I got this thing? Just a little bit confusing.

from td.

levlam avatar levlam commented on May 17, 2024

A "Chat not found" error means that you are trying to pass a hardcoded chat identifier to TDLib. You can only use identifiers received from the same TDLIb instance programmatically.

from td.

SnapdragonLee avatar SnapdragonLee commented on May 17, 2024

I'm sorry that I may not get you. I just wanna send something to 'Saved Message' by TdLib. How could I manage this before sent sendMessage to target chat_id: 19xxxxxxxxx? What function should I call for receiving the chat_id?

from td.

levlam avatar levlam commented on May 17, 2024

You need to use getMe to get the current user, then use createPrivateChat with received user_id to create the chat with self, and then use received chat identifier to send messages.

from td.

Related Issues (20)

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.