{"id":27943368,"url":"https://github.com/fishpioffical/fishpi.js","last_synced_at":"2025-07-17T03:07:58.869Z","repository":{"id":38336039,"uuid":"450767420","full_name":"FishPiOffical/fishpi.js","owner":"FishPiOffical","description":"摸鱼派 API NPM Package","archived":false,"fork":false,"pushed_at":"2025-03-24T01:21:55.000Z","size":155,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-02T19:50:36.555Z","etag":null,"topics":["fishpi","js","npm","ts"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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":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":"2022-01-22T09:05:52.000Z","updated_at":"2025-03-24T01:21:58.000Z","dependencies_parsed_at":"2024-01-15T09:32:09.472Z","dependency_job_id":"fc3be71a-c8b9-4d13-bf29-07b78b2260ca","html_url":"https://github.com/FishPiOffical/fishpi.js","commit_stats":{"total_commits":66,"total_committers":2,"mean_commits":33.0,"dds":"0.19696969696969702","last_synced_commit":"22ce487df0ad50617027ecca9f9b424333689b0e"},"previous_names":["fishpioffical/fishpi-js","fishpioffical/fishpi.js","imlinhanchao/fishpi-api-package"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/FishPiOffical/fishpi.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FishPiOffical%2Ffishpi.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FishPiOffical%2Ffishpi.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FishPiOffical%2Ffishpi.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FishPiOffical%2Ffishpi.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FishPiOffical","download_url":"https://codeload.github.com/FishPiOffical/fishpi.js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FishPiOffical%2Ffishpi.js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265562245,"owners_count":23788491,"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":["fishpi","js","npm","ts"],"created_at":"2025-05-07T12:08:12.437Z","updated_at":"2025-07-17T03:07:58.845Z","avatar_url":"https://github.com/FishPiOffical.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 摸鱼派 API Package\n摸鱼派社区 (https://fishpi.cn/) 的 API Package，可以快速开发出一款应用支援社区功能。\n\n## 支援\n- 用户信息；\n- 聊天室；\n  - 话题编辑；\n  - 红包收发；\n- 自定义表情包；\n- 文件上传；\n- 通知信息；\n- 清风明月；\n- 文章读写；\n- 评论点赞；\n- 私聊功能；\n\n## 安装\n\n```bash\nnpm install fishpi\n```\n\n## 用例\n\n```ts\nimport FishPi from 'fishpi';\n\n// 登录获取 apiKey\nlet apiKey = '';\nlet fish = new FishPi();\nlet rsp = await fish.login({ \n    username: 'username', \n    passwd: 'password123456' \n});\nif (rsp.code == 0) apiKey = rsp.Key;\n\n// 通过 apiKey 获取登录用户信息\nlet fish = new FishPi(apiKey);\nconsole.dir(await fish.account.info());\n\n// 获取用户自定义表情包\nlet emojis = await fish.emoji.get();\n// 获取默认表情包\nlet defaultEmoji = fish.emoji.default;\n\n// 监听聊天室消息\nfish.chatroom.addListener(({ msg }) =\u003e console.dir(msg));\n// 向聊天室发送信息（需要登录）\nawait fish.chatroom.send('Hello World!');\n// 向聊天室发送红包\nawait fish.chatroom.redpacket.send({\n    type: 'random';\n    money: 32;\n    count: 2;\n    msg: '摸鱼者，事竟成！';\n    recivers: [];\n})\n\n// 私聊历史获取\nlet chatHistory = await fish.chat.get({ user: 'username', autoRead: false })\n// 监听私聊新消息\nfishpi.chat.addListener(async ({ msg }: { msg: NoticeMsg }) =\u003e {\n    switch (msg.command) {\n        // 私聊未读数更新\n        case 'chatUnreadCountRefresh':\n            if(msg.count! \u003e 0) {\n                let unreadMsgs = await fishpi.chat.unread();\n            }\n            break;\n        // 新私聊消息\n        case 'newIdleChatMessage':\n            // msg 就是新的私聊消息\n            console.log(msg.senderUserName, '说：', msg.preview);\n            break;\n        // 有新的消息通知\n        case 'refreshNotification':\n            console.log('你有新消息【', await fishpi.notice.count(), '】')\n            break;\n    }\n});\n// 监听指定用户的私聊消息\nfishpi.chat.addListener(({ msg }: { msg: ChatData }) =\u003e {\n    console.log(msg.senderUserName, '[', msg.time, ']：', msg.content);\n}, 'username');\n// 给指定用户发私聊消息\nfishpi.chat.send('username', 'Hi~');\n\n// 金手指\nimport { Finger, FingerTo } from 'fishpi';\n\n// 一次性金手指\nawait FingerTo('GoldenFingerKey').queryLatestLoginIP('username')\n\n// 金手指实例\nconst finger = new Finger(apiKey);\nawait finger.queryLatestLoginIP('username');\n\n```\n\n## 注意事项\n\nAPI 库使用 `fetch` 做 API 请求，浏览器环境可以直接使用。在 Node 环境需要安装 `node-fetch` 2.x 版本的库。执行如下代码设置 `fetch` 函数：\n```typescript\nimport fetch from 'node-fetch'\nglobalThis.fetch = fetch as any;\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffishpioffical%2Ffishpi.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffishpioffical%2Ffishpi.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffishpioffical%2Ffishpi.js/lists"}