{"id":27943365,"url":"https://github.com/fishpioffical/fishpi.dart","last_synced_at":"2025-05-07T12:08:08.103Z","repository":{"id":206626428,"uuid":"713175592","full_name":"FishPiOffical/fishpi.dart","owner":"FishPiOffical","description":"Fishpi Dart API Package and CLI","archived":false,"fork":false,"pushed_at":"2024-12-24T02:09:36.000Z","size":345,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-07T12:07:34.479Z","etag":null,"topics":["cli","dart","fishpi","flutter"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/fishpi","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FishPiOffical.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2023-11-02T01:46:35.000Z","updated_at":"2024-12-24T02:09:39.000Z","dependencies_parsed_at":"2023-11-22T11:11:19.151Z","dependency_job_id":"e0e5045c-66be-47e1-a4c1-632623df2eff","html_url":"https://github.com/FishPiOffical/fishpi.dart","commit_stats":null,"previous_names":["imlinhanchao/fishpi-dart","fishpioffical/fishpi-dart","fishpioffical/fishpi.dart"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FishPiOffical%2Ffishpi.dart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FishPiOffical%2Ffishpi.dart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FishPiOffical%2Ffishpi.dart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FishPiOffical%2Ffishpi.dart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FishPiOffical","download_url":"https://codeload.github.com/FishPiOffical/fishpi.dart/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252873962,"owners_count":21817714,"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":["cli","dart","fishpi","flutter"],"created_at":"2025-05-07T12:08:04.053Z","updated_at":"2025-05-07T12:08:08.098Z","avatar_url":"https://github.com/FishPiOffical.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://fishpi.cn\"\u003e\n    \u003cimg width=\"200\" src=\"https://github.com/imlinhanchao/fishpi-dart/raw/master/logo.png\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003e摸鱼派 Dart 开发包 \u0026 CLI\u003c/h1\u003e\n\n摸鱼打工人社区——[摸鱼派](https://fishpi.cn)开放 API 的开发包，包含社区的所有功能接口。同时，内含一个 CLI 客户端。\n\n## 安装\n\n```bash\n# 全局安装\ndart pub global activate fishpi\n\n# APP 安装\ndart pub add fishpi\n```\n\n## 使用\n\n### CLI\n\n```bash\nCLI 参数：\n\n-f, --upload            上传文件路径\n-o, --origin            服务器地址， 默认为 https://fishpi.cn\n-u, --username          用户名\n-p, --passwd            密码\n-t, --token             API Key\n    --code              需要二次验证码\n    --talk              发送消息到聊天室（需曾经登录过或添加 -u 参数）\n    --barrager          发送弹幕到聊天室（需曾经登录过或添加 -u 参数）\n    --barrager-color    弹幕颜色\n                        (defaults to \"#FFFFFF\")\n-c, --chat              私聊对象\n-s, --say               私聊内容\n    --breezemoon        发送清风明月\n-h, --[no-]help\n    --page              切换启动页面\n                        [user, chatroom (default), chat, breezemoon, article]\n```\n\n进入 CLI 后，输入 `:help` 查看 CLI 内帮助。\n\n### 开发包\n\n```dart\nimport 'package:fishpi/fishpi.dart';\n\nFishpi fishpi = Fishpi();\n\n// 登录\nLoginData loginData = LoginData(\n    username: 'username',\n    passwd: 'password',\n  );\nawait fishpi.login(loginData);\n\n// 获取用户信息\nawait fishpi.user.info();\n\n// 监听聊天室\nawait fishpi.chatroom.addListener((ChatRoomData data) {\n  try {\n    switch (data.type) {\n      case ChatRoomMessageType.online:\n        // 上线消息\n        print(data.online!);\n        break;\n      case ChatRoomMessageType.barrager:\n        // 弹幕消息\n        print(data.barrager!);\n        break;\n      case ChatRoomMessageType.discussChanged:\n        // 话题变更\n        print(data.discuss!);\n        break;\n      case ChatRoomMessageType.msg:\n        // 普通消息\n        print(data.msg!);\n        break;\n      case ChatRoomMessageType.revoke:\n        // 撤回消息\n        print(data.revoke!);\n        break;\n      case ChatRoomMessageType.redPacket:\n        // 红包消息\n        print(data.msg!);\n        break;\n      case ChatRoomMessageType.redPacketStatus:\n        // 红包领取\n        print(data.status!);\n        break;\n      case ChatRoomMessageType.custom:\n        // 自定义消息\n        print(data.custom!);\n        break;\n    }\n  } catch (e) {\n    print('未知异常：$e');\n  }\n});\n\n// 发送消息\nawait fishpi.chatroom.send('Hello World!');\n\n// 发送弹幕\nawait fishpi.chatroom.barrager('Hello World!', color: '#FF0000');\n\n// 发送清风明月\nawait fishpi.breezemoon.send('Hello World!');\n\n```\n\u003e 更多使用方法请参考 [CLI](./bin)。\n\n## 异常处理\n\n所有方法返回值分为两类：`ResponseResult` 和 其他。若方法本身需要返回数据，则会直接返回数据，若发生异常将会通过 Throw 抛出。而无数据返回，则会通过 `ResponseResult` 返回执行的结果。\n\n## 发布\n\n发布包请执行：\n```bash\ndart tools/publish.dart\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffishpioffical%2Ffishpi.dart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffishpioffical%2Ffishpi.dart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffishpioffical%2Ffishpi.dart/lists"}