alexander-akhmetov / python-telegram

Python client for the Telegram's tdlib
MIT License
610 stars 122 forks source link

No Errors, Message does not arrive #222

Closed HemmaCuda closed 1 year ago

HemmaCuda commented 2 years ago

2021-10-26 00:58:12,282 [INFO] telegram.tdjson: Using shared library "/home/hemma/.local/lib/python3.7/site-packages/telegram/lib/linux/libtdjson.so" 2021-10-26 00:58:12,286 [INFO] telegram.client: [Telegram.td_listener] started 2021-10-26 00:58:12,287 [INFO] telegram.worker: [SimpleWorker] started 2021-10-26 00:58:12,288 [INFO] telegram.client: [login] Login process has been started with phone 2021-10-26 00:58:12,288 [INFO] telegram.client: [login] current authorization state: AuthorizationState.NONE 2021-10-26 00:58:12,289 [INFO] telegram.client: [login] current authorization state: AuthorizationState.WAIT_TDLIB_PARAMETERS 2021-10-26 00:58:12,289 [INFO] telegram.client: Setting tdlib initial params: files_dir=/tmp/.tdlib_files/d757776bb0879243a7af56af8970f1d8/, test_dc=False 2021-10-26 00:58:12,290 [INFO] telegram.client: [login] current authorization state: AuthorizationState.WAIT_ENCRYPTION_KEY 2021-10-26 00:58:12,290 [INFO] telegram.client: Sending encryption key [ 2][t 1][1635209892.294188022][Timer.cpp:67][#1][!Td][&duration > maxduration] SLOW: [name:change key][duration:2695.7us] [ 2][t 1][1635209892.294453144][TdDb.cpp:323][#1][!Td] Got PRAGMA user_version = 13 [ 2][t 1][1635209892.301748752][AuthDataShared.cpp:109][#1][!Td] DcId{1} [auth_key_id:10571175674534957020][state:OK][created_at:1634863573.000000] [ 2][t 1][1635209892.304114103][Session.cpp:167][#1][!SessionProxy:1:main] Generate new session_id 18377949823334947257 for auth key 10571175674534957020 for main DC1 chats: {'@type': 'chats', 'total_count': 39, 'chat_ids': [], '@extra': {'request_id': '704822bd08c44f00a7a6d1291526c091'}} message has been sent: {'@type': 'message', 'id': redacted, 'sender': {'@type': 'messageSenderUser', 'user_id': redacted}, 'chat_id': redacted, 'sending_state': {'@type': 'messageSendingStatePending'}, 'is_outgoing': True, 'is_pinned': False, 'can_be_edited': False, 'can_be_forwarded': True, 'can_be_deleted_only_for_self': False, 'can_be_deleted_for_all_users': True, 'can_get_statistics': False, 'can_get_message_thread': False, 'is_channel_post': False, 'contains_unread_mention': False, 'date': 1635209891, 'edit_date': 0, 'reply_in_chat_id': 0, 'reply_to_message_id': 0, 'message_thread_id': 0, 'ttl': 0, 'ttl_expires_in': 0.0, 'via_bot_user_id': 0, 'author_signature': '', 'media_album_id': '0', 'restriction_reason': '', 'content': {'@type': 'messageText', 'text': {'@type': 'formattedText', 'text': 'Testing from South Korea', 'entities': []}}, '@extra': {'request_id': 'a73aa1e31f1047fe86a3bedcc4c0fd33'}} 2021-10-26 00:58:12,326 [INFO] telegram.client: Stopping telegram client... [ 2][t 1][1635209892.326388120][Td.cpp:4110][#1][!Td] Close Td in state 2 [ 2][t 1][1635209892.326542139][Td.cpp:3959][#1][!Td] Have no request actors [ 2][t 1][1635209892.326886415][Td.cpp:3874][#1][!Td] ON_ACTORS_CLOSED 2021-10-26 00:58:12,328 [INFO] telegram.client: Authorization state: AuthorizationState.CLOSING [ 2][t 1][1635209892.336984872][Td.cpp:3935][#1][!Td] ON_CLOSED 2021-10-26 00:58:12,829 [INFO] telegram.client: Authorization state: AuthorizationState.CLOSED [ 2][t 1][1635209893.831141948][Td.cpp:3945][#1][!Td] Stop Td

br0tda commented 2 years ago

Please post your code and some details

New-dev0 commented 2 years ago

I was too facing problem with knowing the error I Tried keeping the config at logging.DEBUG level and error was printed/logged with that.

@alexander-akhmetov can you please look into it and make it like raise Exception, whenever an error is received, It will be more convenient i guess

alexander-akhmetov commented 2 years ago

@HemmaCuda

I'd suggest increasing tdlib verbosity, it might help.

@New-dev0 I Tried keeping the config at logging.DEBUG level and error was printed/logged with that.

Are you talking about an error on the tdlib level? python-telegram is a wrapper around tdlib, so if it returns a message with an error inside, it should be visible on the AsyncResult instance. There might be cases when tdlib sends an error not as a response to a user's message. I'm not sure if this happens, it needs additional investigation.

setop commented 2 years ago

I have the same here, using the send_message example from the repo, set un debug. I get message has been sent:

{
  "@type": "message",
  "id": "REDACTED",
  "sender": {
    "@type": "messageSenderUser",
    "user_id": "REDACTED"
  },
  "chat_id": "REDACTED",
  "sending_state": {
    "@type": "messageSendingStatePending"
  },
  "is_outgoing": true,
  "is_pinned": false,
  "can_be_edited": false,
  "can_be_forwarded": true,
  "can_be_deleted_only_for_self": false,
  "can_be_deleted_for_all_users": true,
  "can_get_statistics": false,
  "can_get_message_thread": false,
  "can_get_viewers": false,
  "can_get_media_timestamp_links": false,
  "has_timestamped_media": true,
  "is_channel_post": false,
  "contains_unread_mention": false,
  "date": 1648849800,
  "edit_date": 0,
  "reply_in_chat_id": 0,
  "reply_to_message_id": 0,
  "message_thread_id": 0,
  "ttl": 0,
  "ttl_expires_in": 0,
  "via_bot_user_id": 0,
  "author_signature": "",
  "media_album_id": "0",
  "restriction_reason": "",
  "content": {
    "@type": "messageText",
    "text": {
      "@type": "formattedText",
      "text": "foo bar baz",
      "entities": []
    }
  },
  "@extra": {
    "request_id": "REDACTED"
  }
}

And nothing suspicious in the debug traces.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.