Metadata-Version: 2.5
Name: igchat-v2
Version: 3.1.0
Summary: Async-first Instagram Direct & Polaris Web GraphQL client library in Python & Go.
Project-URL: Homepage, https://github.com/0xshijn/igchat-v2
Project-URL: Documentation, https://github.com/0xshijn/igchat-v2#readme
Project-URL: Repository, https://github.com/0xshijn/igchat-v2
Project-URL: Issues, https://github.com/0xshijn/igchat-v2/issues
Project-URL: Changelog, https://github.com/0xshijn/igchat-v2/blob/main/CHANGELOG.md
Project-URL: Telegram, https://t.me/ShiinNoHacker
Author: Phước Toàn (Shiin)
Maintainer: Phước Toàn (Shiin)
License:                                  Apache License
                                   Version 2.0, January 2004
                                http://www.apache.org/licenses/
        
           TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
        
           1. Definitions.
        
              "License" shall mean the terms and conditions for use, reproduction,
              and distribution as defined by Sections 1 through 9 of this document.
        
              "Licensor" shall mean the copyright owner or entity authorized by
              the copyright owner that is granting the License.
        
              "Legal Entity" shall mean the union of the acting entity and all
              other entities that control, are controlled by, or are under common
              control with that entity. For the purposes of this definition,
              "control" means (i) the power, direct or indirect, to cause the
              direction or management of such entity, whether by contract or
              otherwise, or (ii) ownership of fifty percent (50%) or more of the
              outstanding shares, or (iii) beneficial ownership of such entity.
        
              "You" (or "Your") shall mean an individual or Legal Entity
              exercising permissions granted by this License.
        
              "Source" form shall mean the preferred form for making modifications,
              including but not limited to software source code, documentation
              source, and configuration files.
        
              "Object" form shall mean any form resulting from mechanical
              transformation or translation of a Source form, including but
              not limited to compiled object code, generated documentation,
              and conversions to other media types.
        
              "Work" shall mean the work of authorship, whether in Source or
              Object form, made available under the License, as indicated by a
              copyright notice that is included in or attached to the work
              (an example is provided in the Appendix below).
        
              "Derivative Works" shall mean any work, whether in Source or Object
              form, that is based on (or derived from) the Work and for which the
              editorial revisions, annotations, elaborations, or other modifications
              represent, as a whole, an original work of authorship. For the purposes
              of this License, Derivative Works shall not include works that remain
              separable from, or merely link (or bind by name) to the interfaces of,
              the Work and Derivative Works thereof.
        
              "Contribution" shall mean any work of authorship, including
              the original version of the Work and any modifications or additions
              to that Work or Derivative Works thereof, that is intentionally
              submitted to Licensor for inclusion in the Work by the copyright owner
              or by an individual or Legal Entity authorized to submit on behalf of
              the copyright owner. For the purposes of this definition, "submitted"
              means any form of electronic, verbal, or written communication sent
              to the Licensor or its representatives, including but not limited to
              communication on electronic mailing lists, source code control systems,
              and issue tracking systems that are managed by, or on behalf of, the
              Licensor for the purpose of discussing and improving the Work, but
              excluding communication that is conspicuously marked or otherwise
              designated in writing by the copyright owner as "Not a Contribution."
        
              "Contributor" shall mean Licensor and any individual or Legal Entity
              on behalf of whom a Contribution has been received by Licensor and
              subsequently incorporated within the Work.
        
           2. Grant of Copyright License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              copyright license to reproduce, prepare Derivative Works of,
              publicly display, publicly perform, sublicense, and distribute the
              Work and such Derivative Works in Source or Object form.
        
           3. Grant of Patent License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              (except as stated in this section) patent license to make, have made,
              use, offer to sell, sell, import, and otherwise transfer the Work,
              where such license applies only to those patent claims licensable
              by such Contributor that are necessarily infringed by their
              Contribution(s) alone or by combination of their Contribution(s)
              with the Work to which such Contribution(s) was submitted. If You
              institute patent litigation against any entity (including a
              cross-claim or counterclaim in a lawsuit) alleging that the Work
              or a Contribution incorporated within the Work constitutes direct
              or contributory patent infringement, then any patent licenses
              granted to You under this License for that Work shall terminate
              as of the date such litigation is filed.
        
           4. Redistribution. You may reproduce and distribute copies of the
              Work or Derivative Works thereof in any medium, with or without
              modifications, and in Source or Object form, provided that You
              meet the following conditions:
        
              (a) You must give any other recipients of the Work or
                  Derivative Works a copy of this License; and
        
              (b) You must cause any modified files to carry prominent notices
                  stating that You changed the files; and
        
              (c) You must retain, in the Source form of any Derivative Works
                  that You distribute, all copyright, patent, trademark, and
                  attribution notices from the Source form of the Work,
                  excluding those notices that do not pertain to any part of
                  the Derivative Works; and
        
              (d) If the Work includes a "NOTICE" text file as part of its
                  distribution, then any Derivative Works that You distribute must
                  include a readable copy of the attribution notices contained
                  within such NOTICE file, excluding those notices that do not
                  pertain to any part of the Derivative Works, in at least one
                  of the following places: within a NOTICE text file distributed
                  as part of the Derivative Works; within the Source form or
                  documentation, if provided along with the Derivative Works; or,
                  within a display generated by the Derivative Works, if and
                  wherever such third-party notices normally appear. The contents
                  of the NOTICE file are for informational purposes only and
                  do not modify the License. You may add Your own attribution
                  notices within Derivative Works that You distribute, alongside
                  or as an addendum to the NOTICE text from the Work, provided
                  that such additional attribution notices cannot be construed
                  as modifying the License.
        
              You may add Your own copyright statement to Your modifications and
              may provide additional or different license terms and conditions
              for use, reproduction, or distribution of Your modifications, or
              for any such Derivative Works as a whole, provided Your use,
              reproduction, and distribution of the Work otherwise complies with
              the conditions stated in this License.
        
           5. Submission of Contributions. Unless You explicitly state otherwise,
              any Contribution intentionally submitted for inclusion in the Work
              by You to the Licensor shall be under the terms and conditions of
              this License, without any additional terms or conditions.
              Notwithstanding the above, nothing herein shall supersede or modify
              the terms of any separate license agreement you may have executed
              with Licensor regarding such Contributions.
        
           6. Trademarks. This License does not grant permission to use the trade
              names, trademarks, service marks, or product names of the Licensor,
              except as required for reasonable and customary use in describing the
              origin of the Work and reproducing the content of the NOTICE file.
        
           7. Disclaimer of Warranty. Unless required by applicable law or
              agreed to in writing, Licensor provides the Work (and each
              Contributor provides its Contributions) on an "AS IS" BASIS,
              WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
              implied, including, without limitation, any warranties or conditions
              of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
              PARTICULAR PURPOSE. You are solely responsible for determining the
              appropriateness of using or redistributing the Work and assume any
              risks associated with Your exercise of permissions under this License.
        
           8. Limitation of Liability. In no event and under no legal theory,
              whether in tort (including negligence), contract, or otherwise,
              unless required by applicable law (such as deliberate and grossly
              negligent acts) or agreed to in writing, shall any Contributor be
              liable to You for damages, including any direct, indirect, special,
              incidental, or consequential damages of any character arising as a
              result of this License or out of the use or inability to use the
              Work (including but not limited to damages for loss of goodwill,
              work stoppage, computer failure or malfunction, or any and all
              other commercial damages or losses), even if such Contributor
              has been advised of the possibility of such damages.
        
           9. Accepting Warranty or Additional Liability. While redistributing
              the Work or Derivative Works thereof, You may choose to offer,
              and charge a fee for, acceptance of support, warranty, indemnity,
              or other liability obligations and/or rights consistent with this
              License. However, in accepting such obligations, You may act only
              on Your own behalf and on Your sole responsibility, not on behalf
              of any other Contributor, and only if You agree to indemnify,
              defend, and hold each Contributor harmless for any liability
              incurred by, or claims asserted against, such Contributor by reason
              of your accepting any such warranty or additional liability.
        
           END OF TERMS AND CONDITIONS
        
           APPENDIX: How to apply the Apache License to your work.
        
              To apply the Apache License to your work, attach the following
              boilerplate notice, with the fields enclosed by brackets "[]"
              replaced with your own identifying information. (Don't include
              the brackets!)  The text should be enclosed in the appropriate
              comment syntax for the file format. We also recommend that a
              file or class name and description of purpose be included on the
              same "printed page" as the copyright notice for easier
              identification within third-party archives.
        
           Copyright [yyyy] [name of copyright owner]
        
           Licensed under the Apache License, Version 2.0 (the "License");
           you may not use this file except in compliance with the License.
           You may obtain a copy of the License at
        
               http://www.apache.org/licenses/LICENSE-2.0
        
           Unless required by applicable law or agreed to in writing, software
           distributed under the License is distributed on an "AS IS" BASIS,
           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
           See the License for the specific language governing permissions and
           limitations under the License.
License-File: LICENSE
Keywords: chatbot,igchat,instagram,instagram-api,instagram-direct,instameow,polaris-graphql
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Communications :: Chat
Classifier: Topic :: Internet
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27.0
Requires-Dist: pyotp>=2.9.0
Provides-Extra: dev
Requires-Dist: black; extra == 'dev'
Requires-Dist: build>=1.2.0; extra == 'dev'
Requires-Dist: mypy>=1.11.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: ruff>=0.4.0; extra == 'dev'
Requires-Dist: twine>=5.0.0; extra == 'dev'
Description-Content-Type: text/markdown

<div align="center">

<a href="https://github.com/0xshijn/igchat-v2">
  <img src="./assets/banner.svg" alt="IGChat-v2 — Async-first Instagram Direct &amp; Polaris GraphQL Client" width="100%" />
</a>

<br />

<p>
  <a href="https://www.python.org/"><img src="https://img.shields.io/badge/Python-3.10%2B-3776AB?style=for-the-badge&labelColor=161928&logo=python&logoColor=white" alt="Python 3.10+" /></a>
  <a href="https://go.dev/"><img src="https://img.shields.io/badge/Go%20Bridge-1.23%2B-0891B2?style=for-the-badge&labelColor=161928&logo=go&logoColor=white" alt="Go 1.23+" /></a>
  <a href="LICENSE"><img src="https://img.shields.io/badge/License-Apache--2.0-7C3AED?style=for-the-badge&labelColor=161928" alt="Apache-2.0 License" /></a>
  <a href="https://github.com/0xshijn"><img src="https://img.shields.io/badge/Author-0xshijn-1F2437?style=for-the-badge&labelColor=161928&logo=github&logoColor=white" alt="Author 0xshijn" /></a>
  <a href="https://t.me/ShiinNoHacker"><img src="https://img.shields.io/badge/Telegram-%40ShiinNoHacker-1F2437?style=for-the-badge&labelColor=161928&logo=telegram&logoColor=06B6D4" alt="Telegram" /></a>
</p>

<p>
  <a href="https://github.com/0xshijn/igchat-v2/stargazers"><img src="https://img.shields.io/github/stars/0xshijn/igchat-v2?style=flat-square&logo=github&color=38bdf8" alt="Stars" /></a>
  <a href="https://github.com/0xshijn/igchat-v2/network/members"><img src="https://img.shields.io/github/forks/0xshijn/igchat-v2?style=flat-square&logo=github&color=a855f7" alt="Forks" /></a>
  <a href="https://github.com/0xshijn/igchat-v2/issues"><img src="https://img.shields.io/github/issues/0xshijn/igchat-v2?style=flat-square&logo=github&color=22c55e" alt="Issues" /></a>
  <a href="https://github.com/0xshijn/igchat-v2/actions/workflows/ci.yml"><img src="https://github.com/0xshijn/igchat-v2/actions/workflows/ci.yml/badge.svg" alt="CI Status" /></a>
  <img src="https://img.shields.io/badge/Version-v3.1.0-f59e0b?style=flat-square" alt="Version 3.1.0" />
</p>

[🇬🇧 English](README_EN.md) · [💡 Ví dụ mẫu](examples/) · [🛡️ Bảo mật](SECURITY.md) · [🤝 Đóng góp](CONTRIBUTING.md) · [🌉 Go Bridge](bridge/README.md) · [🐛 Báo lỗi](https://github.com/0xshijn/igchat-v2/issues)

</div>

> *"Pwn the protocol, dissect the wire, automate the unscriptable."* — **0xshijn**

> [!WARNING]
> **IGChat-v2** là client không chính thức phục vụ mục đích nghiên cứu giao thức và tự động hóa Instagram Direct. Thư viện sử dụng cookie/phiên tài khoản cá nhân. Tuyệt đối không commit file chứa cookie (`config.json`) hoặc để lộ `sessionid` ra môi trường công cộng.

---

## 🎯 Giới thiệu tổng quan

**IGChat-v2 (v3.0.0)** được thiết kế và phát triển bởi **Phước Toàn (Shiin / [`0xshijn`](https://github.com/0xshijn))** như một giải pháp toàn diện, độc lập và chuẩn xác để tự động hóa **Instagram Direct** và các tính năng tương tác mạng xã hội Instagram.

**v3.0.0** mang đến nền tảng hiện đại, tối ưu và chuẩn xác dành riêng cho Instagram:
- ✅ **100% Pure Instagram**: Sử dụng chuẩn Instagram Direct DGW WebSocket, Slide GraphQL, và Polaris Web REST API.
- ✅ **Kiến trúc phân tầng chuyên nghiệp**: Python Async Client (`igchat`) kết hợp Go Bridge companion (`instameow`) giao tiếp qua JSON-RPC 2.0 dòng.

---

## ⚡ Điểm nổi bật & Tính năng kỹ thuật

<table>
  <tr>
    <td width="50%" valign="top">
      <h4>🚀 Async-First Python Client</h4>
      <p>Toàn bộ I/O xây dựng trên <code>asyncio</code> và <code>httpx.AsyncClient</code> với connection pooling tối ưu, timeout hữu hạn, và kiểm soát ngoại lệ chuẩn xác.</p>
    </td>
    <td width="50%" valign="top">
      <h4>🌉 Go Bridge thời gian thực (v3.0.0)</h4>
      <p>Tiến trình Go (<code>build/igchat-bridge.exe</code>) tích hợp <code>instameow</code> xử lý WebSocket DGW và MQTT bypass với cơ chế generation-fenced và tự động phục hồi.</p>
    </td>
  </tr>
  <tr>
    <td width="50%" valign="top">
      <h4>🛡️ Bảo vệ an toàn &amp; SSRF Guard</h4>
      <p>Kiểm tra URL nghiêm ngặt chặn tấn công SSRF vào mạng nội bộ/cloud metadata khi tải media; che giấu bí mật tự động trong log stderr; khóa quyền file lưu trữ (<code>0600</code> / Windows ACL).</p>
    </td>
    <td width="50%" valign="top">
      <h4>🤖 Khung Bot tích hợp sẵn</h4>
      <p>Lớp <code>InstagramBot</code> sẵn sàng vận hành với bộ đệm LRU chống lặp tin nhắn, rate-limiting độc lập theo từng user, router lệnh async và hỗ trợ quyền Admin an toàn.</p>
    </td>
  </tr>
</table>

---

## 🏗️ Kiến trúc hệ thống

```mermaid
flowchart LR
    App["Ứng dụng Python / Bot"] --> BotMod["igchat.bot"]
    BotMod --> DirectMod["igchat.direct"]
    BotMod --> SocialMod["igchat.social"]

    DirectMod --> BridgeMod["igchat.bridge"]
    DirectMod --> CoreMod["igchat.core"]
    SocialMod --> CoreMod
    
    BridgeMod <-->|"JSON-RPC 2.0 (stdin/stdout)"| BridgeGo["Go Bridge (igchat-bridge.exe)"]
    BridgeGo <-->|"DGW WebSocket / Slide GraphQL"| IGDirect["Instagram Direct Engine"]
    CoreMod <-->|"HTTPS (httpx connection pool)"| IGRest["Polaris Web REST/GraphQL"]
```

| Package / Module | Đường dẫn | Vai trò |
|---|---|---|
| **`igchat.client`** | [`igchat/client.py`](igchat/client.py) | **High-Level Fluent SDK (`IGClient`)**: Context manager, event decorators `@client.on(...)`, pagination tự động |
| **`igchat.filters`** | [`igchat/filters.py`](igchat/filters.py) | **Bộ lọc tin nhắn nâng cao**: Hỗ trợ toán tử logic `&`, `\|`, `~`, `^` (text, command, regex, media, group, sender...) |
| **`igchat.stealth`** | [`igchat/stealth.py`](igchat/stealth.py) | **Ghost Mode & Humanizer**: Ẩn danh hoàn toàn (chặn presence/đã xem), mô phỏng tốc độ gõ phím phân phối Gaussian |
| **`igchat.export`** | [`igchat/export.py`](igchat/export.py) | **Sao lưu hội thoại forensic**: Xuất dữ liệu Direct ra JSON, Markdown hoặc trang HTML Dark Mode giao diện Instagram |
| **`igchat.core`** | [`igchat/core/`](igchat/core/) | Data models (`InstagramSession`, `MessageEvent`), HTTP pooling, SSRF guard, bảo mật file, redaction |
| **`igchat.auth`** | [`igchat/auth/`](igchat/auth/) | Bootstrap session, **Encrypted Vault (PBKDF2 + authenticated stream cipher)**, Web AJAX login kèm 2FA TOTP |
| **`igchat.bridge`** | [`igchat/bridge/`](igchat/bridge/) | Quản lý tiến trình Go Bridge qua line JSON-RPC, generation-fencing, ReconnectPolicy exponential backoff |
| **`igchat.direct`** | [`igchat/direct/`](igchat/direct/) | Direct listener, gửi/sửa/thu hồi tin, reaction, **Themes & Direct Polls**, **Voice waveform (64 peaks)** |
| **`igchat.social`** | [`igchat/social/`](igchat/social/) | Profile, bio, quan hệ bạn bè, **Phân tích Unfollowers & Close Friends (`analytics.py`)**, tương tác bài viết |
| **`igchat.bot`** | [`igchat/bot/`](igchat/bot/) | Khung bot hoàn chỉnh, router lệnh, bộ lọc chống spam, rate limiter theo user, xử lý tín hiệu OS |
| **`bridge/`** | [`bridge/`](bridge/README.md) | Source code Go bridge dựa trên `instameow` biên dịch ra `build/igchat-bridge.exe` |

---

## 🛠️ Cài đặt & Chuẩn bị môi trường

### Yêu cầu hệ thống

- **Python 3.10+** (khuyên dùng Python 3.11 hoặc 3.12/3.13)
- **Go 1.23+** (dùng để biên dịch bridge Go)
- **Git** (để clone submodule `bridge/meta`)

### 1. Clone repository & cài đặt Python package

```bash
git clone https://github.com/0xshijn/igchat-v2.git
cd igchat-v2

# Khởi tạo môi trường ảo Python
python -m venv .venv

# Kích hoạt môi trường ảo:
# Windows (PowerShell):
.venv\Scripts\Activate.ps1
# Linux / macOS:
source .venv/bin/activate

# Nâng cấp pip và cài đặt phụ thuộc
python -m pip install --upgrade pip
python -m pip install -e .
```

### 2. Biên dịch Go Bridge companion

```bash
cd bridge
go test -v ./...
go build -trimpath -ldflags="-s -w -X main.bridgeVersion=3.0.0" -o ../build/igchat-bridge.exe .
cd ..
```

Kiểm tra binary bridge bằng script smoke test:

```bash
python scripts/smoke_bridge_rpc.py build/igchat-bridge.exe --expected-version 3.0.0
```

---

## 🚀 Hướng dẫn sử dụng nhanh

### 1. Gửi tin nhắn Direct cơ bản

```python
import asyncio
from igchat.auth import bootstrap_session
from igchat.direct import send_text_message


async def main() -> None:
    # 1. Khởi tạo session từ cookie Instagram
    cookie_str = "sessionid=YOUR_SESSION_ID; ds_user_id=YOUR_USER_ID; csrftoken=YOUR_CSRF_TOKEN;"
    session = await bootstrap_session(cookie_str)
    print(f"Logged in as: @{session.username} ({session.user_id})")

    # 2. Gửi tin nhắn Direct qua Polaris Web GraphQL
    result = await send_text_message(
        session,
        thread_id="340282366841710300949128134123456789012",
        text="Hello from igchat v3.0.0!",
    )
    print(f"Message sent! ID: {result.get('message_id')}")


if __name__ == "__main__":
    asyncio.run(main())
```

### 2. Lắng nghe tin nhắn theo thời gian thực (DirectListener)

```python
import asyncio
from typing import Any
from igchat.auth import bootstrap_session
from igchat.direct import DirectListener


async def handle_message(event: dict[str, Any]) -> None:
    data = event.get("data", {})
    thread_id = data.get("threadId") or data.get("thread_id")
    sender_id = data.get("senderId") or data.get("sender_id")
    text = data.get("text", "")
    print(f"[{thread_id}] @{sender_id}: {text}")


async def main() -> None:
    session = await bootstrap_session("sessionid=...; ds_user_id=...; csrftoken=...;")
    listener = DirectListener(session=session)
    listener.on_message(handle_message)

    print("Đang lắng nghe tin nhắn Instagram Direct...")
    await listener.start()


if __name__ == "__main__":
    asyncio.run(main())
```

### 3. Sử dụng Fluent SDK hiện đại (`IGClient`)

```python
import asyncio
from igchat import IGClient, filters
from igchat.stealth import GhostMode, Humanizer


async def main() -> None:
    # Khởi tạo client hiện đại với Ghost Mode (chống phát hiện / ẩn trạng thái online)
    stealth = GhostMode(stealth_read_receipts=True, suppress_presence=True)

    async with IGClient(cookie="sessionid=...; ds_user_id=...;", stealth=stealth) as client:
        print(f"Connected as @{client.username} (ID: {client.user_id})")

        # 1. Gửi tin nhắn kèm độ trễ gõ phím người thật
        humanizer = Humanizer(cpm=320.0)
        await humanizer.simulate_typing(client.session, "340282366841710300949128134123456789012", 20)
        await client.send_text("340282366841710300949128134123456789012", "Hello via Fluent IGClient!")

        # 2. Xử lý sự kiện với bộ lọc kết hợp (bitwise operators)
        @client.on(filters.command("hello") & filters.private)
        async def on_hello(event: dict) -> None:
            thread_id = event["data"]["threadId"]
            await client.send_text(thread_id, "Hello! I am running on pure Python async IGClient.")

        # 3. Phân tích người không follow lại (Non-followers)
        analytics = await client.analyze_followers()
        print(f"Ai không follow lại tôi: {analytics.not_following_back}")


if __name__ == "__main__":
    asyncio.run(main())
```

---

## 🤖 Khởi chạy Bot Mẫu (`main.py`)

Dự án cung cấp sẵn khung bot hoàn chỉnh với đầy đủ các lệnh tiện ích và quản trị.

### 1. Cấu hình bot

Sao chép file cấu hình mẫu:

```bash
cp config.example.json config.json
```

Chỉnh sửa nội dung `config.json`:

```json
{
  "botName": "igchat-v2 bot",
  "prefix": "/",
  "cookies": "sessionid=...; ds_user_id=...; csrftoken=...;",
  "admins": ["1000xxxxxxxxxx"],
  "log_message_content": false,
  "debug_errors": false
}
```

### 2. Chạy bot

```bash
python main.py
```

<details>
<summary>📋 <b>Danh sách 54 lệnh tích hợp sẵn trong bot (Bấm để xem chi tiết)</b></summary>

<br />

| Nhóm | Lệnh | Mô tả |
|---|---|---|
| **Hệ thống** | `/hi`, `/ping`, `/help`, `/id`, `/notif` | Kiểm tra kết nối, độ trễ, danh sách lệnh, thread/user ID, thông báo gần đây |
| **Tin nhắn** | `/echo`, `/react`, `/edit`, `/unsend`, `/pin`, `/unpin`, `/forward`, `/more` | Lặp lại nội dung, thả cảm xúc, sửa/thu hồi tin E2EE, ghim/bỏ ghim, chuyển tiếp |
| **Bảo vệ** | `/antiunsend [on\|off]`, `/antiedit [on\|off]` | Tự động phát hiện và cảnh báo khi có tin nhắn bị thu hồi hoặc chỉnh sửa |
| **Quản trị Nhóm** | `/rename`, `/groupavatar`, `/tagall`, `/mute`, `/pinthread`, `/add`, `/kick`, `/promote`, `/demote`, `/leave` | Đổi tên nhóm, đổi avatar, tag tất cả, bật/tắt thông báo, thêm/xóa thành viên, thăng/hạ admin |
| **Hộp thư** | `/inbox`, `/thread [số]`, `/requests`, `/accept <id>`, `/deletethread` | Xem hộp thư gần đây, lịch sử chat, duyệt tin nhắn chờ, xóa cuộc trò chuyện |
| **Instagram Notes** | `/note [text\|clear\|list]`, `/delnote`, `/notes`, `/notemusic <bài>`, `/music <q>` | Đăng/xóa Note 24h, đăng Note kèm bài hát, tìm kiếm âm nhạc |
| **Mạng xã hội** | `/info`, `/profile <user>`, `/bio <text>`, `/follow`, `/unfollow`, `/block`, `/unblock`, `/search <q>` | Xem profile, đổi bio bot, theo dõi/hủy theo dõi, chặn/bỏ chặn, tìm kiếm người dùng |
| **Media & Tải về** | `/image <url>`, `/voice <url>`, `/media`, `/dl <url>`, `/autodl [on\|off]`, `/post`, `/upstory` | Gửi ảnh/voice từ URL, bóc tách link tải Reel/Post, tự động tải link IG, đăng bài lên Feed/Story |
| **Tương tác Bài viết** | `/like <url>`, `/unlike`, `/comment <url> <text>`, `/save`, `/unsave` | Thả tim/bỏ tim bài viết, gửi bình luận, lưu/bỏ lưu bài viết Instagram |

</details>

---

## 🧪 Kiểm thử chất lượng mã nguồn (Quality Gate)

Dự án đạt 100% tiêu chuẩn chất lượng nghiêm ngặt trước khi đóng gói:

```bash
# 1. Chạy toàn bộ test suite Python (50 unit tests & 54 command runner tests)
pytest tests/ -v
python tests/test_all_commands.py

# 2. Kiểm tra định dạng mã nguồn
black --check .
ruff check .

# 3. Kiểm tra kiểu dữ liệu tĩnh nghiêm ngặt
mypy igchat main.py scripts examples tests

# 4. Kiểm tra Go Bridge
cd bridge && go test -v . ./bridge && go vet . ./bridge && cd ..
```

---

## 📜 Giấy phép & Tác giả

Dự án được phân phối dưới giấy phép [**Apache License 2.0**](LICENSE).  
Thành phần Go bridge sử dụng `instameow` thuộc [mautrix-meta](https://github.com/mautrix/meta) theo giấy phép GPL-3.0.

<div align="center">

Phát triển & duy trì bởi **[Phước Toàn (Shiin / 0xshijn)](https://github.com/0xshijn)**
<br />
[Portfolio](https://0xshijn.is-a.dev) · [Telegram](https://t.me/ShiinNoHacker) · [Instagram](https://instagram.com/_phwctoazn) · [GitHub](https://github.com/0xshijn)

</div>
