tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

sendMessage to a private chat returns TdError with code 400, 'Chat not found'. #2398

Closed AndrewTran2018 closed 1 year ago

AndrewTran2018 commented 1 year ago

I'm using tdlib 1.8.11. Please help @levlam @sebix

levlam commented 1 year ago

See https://github.com/tdlib/td/issues/578. This particular issue is about user identifiers, but everything written there can be also applied to chat identifiers. You can't use a chat identifier, unless you received it from TDLib after instance restart.

AndrewTran2018 commented 1 year ago

See #578. This particular issue is about user identifiers, but everything written there can be also applied to chat identifiers. You can't use a chat identifier, unless you received it from TDLib after instance restart.

This seems to be solved by calling GetChats at the first time login @levlam

AndrewTran2018 commented 1 year ago

@levlam I solve it by calling CreatePrivateChat(chatId) before sendMessage