{"id":13815144,"url":"https://github.com/lilydjwg/luoxu","last_synced_at":"2025-05-16T15:09:21.535Z","repository":{"id":40439054,"uuid":"361671446","full_name":"lilydjwg/luoxu","owner":"lilydjwg","description":"A Telegram userbot to index Chinese and Japanese group contents.","archived":false,"fork":false,"pushed_at":"2025-05-16T10:30:10.000Z","size":147,"stargazers_count":294,"open_issues_count":4,"forks_count":24,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-16T11:32:00.902Z","etag":null,"topics":["chinese","telegram","telegram-bot","telegram-userbot"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lilydjwg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-04-26T08:18:34.000Z","updated_at":"2025-05-16T10:30:14.000Z","dependencies_parsed_at":"2023-02-15T07:16:41.980Z","dependency_job_id":"c817ba63-cfaa-4691-afc7-3b6462f47522","html_url":"https://github.com/lilydjwg/luoxu","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lilydjwg%2Fluoxu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lilydjwg%2Fluoxu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lilydjwg%2Fluoxu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lilydjwg%2Fluoxu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lilydjwg","download_url":"https://codeload.github.com/lilydjwg/luoxu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254553958,"owners_count":22090417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chinese","telegram","telegram-bot","telegram-userbot"],"created_at":"2024-08-04T04:03:01.528Z","updated_at":"2025-05-16T15:09:16.526Z","avatar_url":"https://github.com/lilydjwg.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"功能说明\n====\n\n落絮可以 CJK 友善的方式索引 Telegram 群组与频道，并提供 API 供前端使用。\n\n风险提示\n====\n\n本程序使用 userbot，有被封号的风险。请三思而后行！\n\n安装与配置\n====\n\n配置 luoxu\n----\n\n* 安装 Rust nightly 以及 [OpenCC](https://github.com/BYVoid/OpenCC) 库。\n\n```bash\ncurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\nrustup toolchain install nightly\n```\n\n* Python 库依赖请见 `requirements.txt` 文件\n* [获取](https://core.telegram.org/api/obtaining_api_id)一份 Telegram API key\n* 在 `querytrans` 目录下运行 `rustup run nightly cargo build --release` 然后把生成的文件（`target/release/libquerytrans.so`）复制为 `querytrans.so` 并放在 Python 能找到的地方（比如当前目录）需要注意的是：构建 `querytrans` 之前需要提前准备好 python 环境，如果与运行 luoxu 的环境不一致将会出错。\n* 复制 `config.toml.example` 并按需要修改\n* （可选）词云插件需要在 `luoxu-cutwords` 下运行 `cargo build --release` 并将生成的可执行文件放到 `$PATH` 中\n\n使用 `python -m luoxu.ls_dialogs` 可以列出会话的 id 和名称。频道和群组的 id 可以用于配置文件中。\n\n设置数据库\n----\n\n* 安装 PostgreSQL 及 pgroonga\n* 使用 `createdb` 命令创建数据库\n* 使用 `postgres` 用户身份连接到该数据库，并执行 `CREATE EXTENSION pgroonga;`\n* 导入 `dbsetup.sql` 脚本，如 `psql DBNAME \u003c dbsetup.sql`\n\n运行\n----\n\n在本项目目录下（或者将本项目目录加入 Python 模块路径），执行：\n\n```sh\npython -m luoxu\n```\n\n配置 Web 前端\n----\n\n* 可使用 [luoxu-web](https://github.com/lilydjwg/luoxu-web)\n* 修改 `src/App.svelte` 中的 API URL\n* 运行 `npm run build` 编译文件\n* 使用 Web 服务器 serve `dist` 目录\n\n你也可以使用 Vercel 来方便快捷地部署此项目。\n\n当然了，你也可以自己另外编写 Web 页面来使用此 API。\n\n注意事项\n====\n\n不要直接将索引了私有群组/频道的 API 公开于网络上！任何人都能获取其内容的。公开索引了公开群组或频道的服务前，也请获取群组/频道管理员的同意。\n\nluoxu 相当于运行一个 Telegram 客户端，其权限是完全的（包括创建新的登录、结束已有会话、设置两步验证等）。请注意保护账号安全，不要在不信任的服务器上登录与运行本项目！\n\n请注意配置数据库权限。Arch Linux 上默认安装的 PostgreSQL 很可能是对本地用户不设防的（请查阅 `/var/lib/postgres/data/pg_hba.conf` 配置文件）。\n\n使用\n====\n\n搜索消息时，搜索字符串不区分简繁（会使用 OpenCC 自动转换），也不进行分词（请手动将可能不连在一起的词语以空格分开）。\n\n搜索字符串支持以下功能：\n\n* 以空格分开的多个搜索词是「与」的关系\n* 使用 `OR`（全大写）来表达「或」条件\n* 使用 `-` 来表达排除，如 `落絮 - 测试`\n* 使用小括号来分组\n\n数据库升级\n====\n\n当对 PostgreSQL 进行跨版本升级时，需要额外处理 pgroonga 的事情。\n\n步骤示意：\n\n1. 安装新的数据库软件\n2. `cp /usr/lib/postgresql/pgroonga* /opt/pgsql-13/lib`\n3. 安装新的 pgroonga\n4. 执行升级（`pg_upgrade`）\n5. 如果 pgroonga 版本已更新，执行 [pgroonga 升级流程](https://pgroonga.github.io/upgrade/)\n5. 升级完成之后需要重新索引（如果索引已被连带删除，从 SQL 文件中找到创建索引的语句并执行）：\n\n```sql\nreindex index usernames_idx;\nreindex index message_idx;\n```\n\n不兼容的变更\n====\n\n* [2022年06月23日](update-2022-06-23.md)，采用分区表来提升部分查询的性能。需要更新配置文件及数据库。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flilydjwg%2Fluoxu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flilydjwg%2Fluoxu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flilydjwg%2Fluoxu/lists"}