diff --git a/packit/.elyxbuilder/stats.yml b/packit/.elyxbuilder/stats.yml index 5c38753..255a02c 100644 --- a/packit/.elyxbuilder/stats.yml +++ b/packit/.elyxbuilder/stats.yml @@ -1,4 +1,4 @@ -builds: 559 +builds: 562 compiledBuilds: 21 failedBuilds: 9 -uncompiledBuilds: 529 +uncompiledBuilds: 532 diff --git a/packit/meta.yml b/packit/meta.yml index 2677e18..a8935ee 100644 --- a/packit/meta.yml +++ b/packit/meta.yml @@ -1,7 +1,7 @@ name: PackIt description: "{plugin_description} [shareui/packit-source](https://github.com/shareui/packit-source)" id: shareui_packit -version: "0.1.1-dev" +version: "1.0.0-dev" author: "@packitX" app_version: ">=12.9.0" sdk_version: ">=1.4.5.0" diff --git a/packit/src/python/integrations/chat/inline/InlineBtns.py b/packit/src/python/integrations/chat/inline/InlineBtns.py index 1c649c8..39aca6c 100644 --- a/packit/src/python/integrations/chat/inline/InlineBtns.py +++ b/packit/src/python/integrations/chat/inline/InlineBtns.py @@ -412,19 +412,27 @@ def dismiss_loading(): logx(f"inlineBtns: downloaded {len(r.content)} bytes to {file_path}", True) # send document to the current dialog — and, in a forum, to the topic - # the message lives in. send_document() only takes a peer, so the file - # always landed in the General topic; send_message() carries - # replyToTopMsg the same way the inline message send does. + # the message lives in. send_document() is the high-level helper that + # correctly builds SendMessageParams for file sending. try: dialog_id = message_object.getDialogId() - params = {"peer": dialog_id, "path": file_path} topic_msg_obj = _resolve_topic_message(dialog_id) + send_kwargs = {} if topic_msg_obj is not None: - params["replyToMsg"] = topic_msg_obj - params["replyToTopMsg"] = topic_msg_obj - from client_utils import send_message - send_message(params) - logx(f"inlineBtns: sent document to dialog_id={dialog_id} topic={topic_msg_obj is not None}", True) + send_kwargs["replyToMsg"] = topic_msg_obj + send_kwargs["replyToTopMsg"] = topic_msg_obj + + from client_utils import send_document + + # send_document calls SendMessagesHelper which requires main thread + def _send_on_main(): + try: + send_document(dialog_id, file_path, **send_kwargs) + logx(f"inlineBtns: sent document to dialog_id={dialog_id} topic={topic_msg_obj is not None}", True) + except Exception as e: + logx(f"inlineBtns: send_document on main error: {e}", False) + + _run(_send_on_main) except Exception as e: logx(f"inlineBtns: send document error: {e}", False) _run(dismiss_loading)