fishpi 0.0.63 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +98 -105
- package/lib/cli.cjs +9550 -0
- package/lib/cli.cjs.map +1 -0
- package/lib/index.cjs +4393 -0
- package/lib/index.cjs.map +1 -0
- package/lib/index.d.ts +3815 -119
- package/lib/index.esm.js +4364 -0
- package/lib/index.esm.js.map +1 -0
- package/package.json +85 -56
- package/lib/article.d.ts +0 -109
- package/lib/article.js +0 -465
- package/lib/breezemoon.d.ts +0 -31
- package/lib/breezemoon.js +0 -144
- package/lib/chat.d.ts +0 -88
- package/lib/chat.js +0 -370
- package/lib/chatroom.d.ts +0 -142
- package/lib/chatroom.js +0 -663
- package/lib/comment.d.ts +0 -53
- package/lib/comment.js +0 -214
- package/lib/emoji.d.ts +0 -201
- package/lib/emoji.js +0 -381
- package/lib/finger.d.ts +0 -73
- package/lib/finger.js +0 -390
- package/lib/index.js +0 -475
- package/lib/notice.d.ts +0 -31
- package/lib/notice.js +0 -158
- package/lib/typing.d.ts +0 -2478
- package/lib/typing.js +0 -594
- package/lib/user.d.ts +0 -52
- package/lib/user.js +0 -266
- package/lib/utils.d.ts +0 -12
- package/lib/utils.js +0 -159
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Hancel Lin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,106 +1,99 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
-
|
|
7
|
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
let
|
|
31
|
-
let
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
import
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
## 注意事项
|
|
101
|
-
|
|
102
|
-
API 库使用 `fetch` 做 API 请求,浏览器环境可以直接使用。在 Node 环境需要安装 `node-fetch` 2.x 版本的库。执行如下代码设置 `fetch` 函数:
|
|
103
|
-
```typescript
|
|
104
|
-
import fetch from 'node-fetch'
|
|
105
|
-
globalThis.fetch = fetch as any;
|
|
1
|
+
# Fishpi.js
|
|
2
|
+
|
|
3
|
+
摸鱼派社区 (https://fishpi.cn/) 的 API Package,可以快速开发出一款应用支援社区功能。
|
|
4
|
+
|
|
5
|
+
## 功能
|
|
6
|
+
- 用户信息;
|
|
7
|
+
- 聊天室;
|
|
8
|
+
- 话题编辑;
|
|
9
|
+
- 红包收发;
|
|
10
|
+
- 自定义表情包;
|
|
11
|
+
- 文件上传;
|
|
12
|
+
- 通知信息;
|
|
13
|
+
- 清风明月;
|
|
14
|
+
- 文章读写;
|
|
15
|
+
- 评论点赞;
|
|
16
|
+
- 私聊功能;
|
|
17
|
+
|
|
18
|
+
## 安装
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install fishpi
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 用例
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import FishPi from 'fishpi';
|
|
28
|
+
|
|
29
|
+
// 登录获取 apiKey
|
|
30
|
+
let apiKey = '';
|
|
31
|
+
let fish = new FishPi();
|
|
32
|
+
let rsp = await fish.login({
|
|
33
|
+
username: 'username',
|
|
34
|
+
passwd: 'password123456'
|
|
35
|
+
});
|
|
36
|
+
if (rsp.code == 0) apiKey = rsp.Key;
|
|
37
|
+
|
|
38
|
+
// 通过 apiKey 获取登录用户信息
|
|
39
|
+
let fish = new FishPi(apiKey);
|
|
40
|
+
console.dir(await fish.account.info());
|
|
41
|
+
|
|
42
|
+
// 获取用户自定义表情包
|
|
43
|
+
let emojis = await fish.emoji.get();
|
|
44
|
+
// 获取默认表情包
|
|
45
|
+
let defaultEmoji = fish.emoji.default;
|
|
46
|
+
|
|
47
|
+
// 监听聊天室消息
|
|
48
|
+
fish.chatroom.on('msg', (msg) => console.dir(msg));
|
|
49
|
+
// 向聊天室发送信息(需要登录)
|
|
50
|
+
await fish.chatroom.send('Hello World!');
|
|
51
|
+
// 向聊天室发送红包
|
|
52
|
+
await fish.chatroom.redpacket.send({
|
|
53
|
+
type: 'random';
|
|
54
|
+
money: 32;
|
|
55
|
+
count: 2;
|
|
56
|
+
msg: '摸鱼者,事竟成!';
|
|
57
|
+
recivers: [];
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
// 私聊历史获取
|
|
61
|
+
let chatHistory = await fish.chat.get({ user: 'username', autoRead: false })
|
|
62
|
+
// 监听私聊新消息
|
|
63
|
+
fishpi.notice.on('newIdleChatMessage', (msg: NoticeMsg) => {
|
|
64
|
+
console.log(msg.senderUserName, '说:', msg.preview);
|
|
65
|
+
});
|
|
66
|
+
// 监听指定用户的私聊消息
|
|
67
|
+
fishpi.chat.channel('username').on('data', (msg: ChatData) => {
|
|
68
|
+
console.log(msg.senderUserName, '[', msg.time, ']:', msg.content);
|
|
69
|
+
);
|
|
70
|
+
// 给指定用户发私聊消息
|
|
71
|
+
fishpi.chat.channel('username').send('Hi~');
|
|
72
|
+
|
|
73
|
+
// 金手指
|
|
74
|
+
import { Finger, FingerTo } from 'fishpi';
|
|
75
|
+
|
|
76
|
+
// 一次性金手指
|
|
77
|
+
await FingerTo('GoldenFingerKey').queryLatestLoginIP('username')
|
|
78
|
+
|
|
79
|
+
// 金手指实例
|
|
80
|
+
const finger = new Finger(apiKey);
|
|
81
|
+
await finger.queryLatestLoginIP('username');
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## 注意事项
|
|
86
|
+
|
|
87
|
+
API 库使用 `fetch` 做 API 请求,浏览器环境可以直接使用。在 Node 环境需要安装 `node-fetch` 2.x 版本的库。执行如下代码设置 `fetch` 函数:
|
|
88
|
+
```typescript
|
|
89
|
+
import fetch from 'node-fetch'
|
|
90
|
+
globalThis.fetch = fetch as any;
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## 命令行工具
|
|
94
|
+
|
|
95
|
+
全局安装可以直接通过 `fishpi` 执行一个摸鱼派命令行工具,包含几乎所有功能。
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
npm i -g fishpi
|
|
106
99
|
```
|