karin-plugin-teamspeak 1.5.5 → 1.5.6
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/README.md +40 -0
- package/lib/apps/ts3.js +1 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,3 +13,43 @@ karin 下的 [teamspeak](https://www.teamspeak.com/zh-CN/) 插件,使用 ts
|
|
|
13
13
|
2. 运行 `npx karin .`
|
|
14
14
|
3. 在 karin web 界面的插件页签中配置该插件
|
|
15
15
|
4. 保存配置后查看命令行是否成功连接服务器
|
|
16
|
+
|
|
17
|
+
# 功能
|
|
18
|
+
|
|
19
|
+
1. 监听 ts 服务器用户进入离开事件,在配置的群聊里发送用户进出提示 如:`xxx进入ts`、`xxx离开ts`
|
|
20
|
+
2. 在群聊或私聊发送`人数`时,发送当前服务器内有人在的频道的人数和进入时长 如:
|
|
21
|
+
```
|
|
22
|
+
====服务器名====
|
|
23
|
+
仅展示有人的频道
|
|
24
|
+
当前频道内共有4人
|
|
25
|
+
======
|
|
26
|
+
聊天听歌等待区
|
|
27
|
+
- BOT (29005287:9)
|
|
28
|
+
- xxx (0:4)
|
|
29
|
+
======
|
|
30
|
+
fps2
|
|
31
|
+
- xxx (0:31)
|
|
32
|
+
======
|
|
33
|
+
fps3
|
|
34
|
+
- xxx (96:31)
|
|
35
|
+
======
|
|
36
|
+
```
|
|
37
|
+
3. 可以通过调用接口 `/api/teamspeak/getAllUserList` 来获取当前服务器内所有频道内人数和进入时长包括没人在的频道,返回的数据格式为:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"name": "配置内的服务器名或host",
|
|
42
|
+
"res": "
|
|
43
|
+
{
|
|
44
|
+
频道1:[{
|
|
45
|
+
nickName:'xxx', //昵称
|
|
46
|
+
lastconnected: 'YYYY-MM-DD HH:mm:ss', //上次连接进来的时间
|
|
47
|
+
connectTime:'', //已经连接的时间 - 单位分:秒
|
|
48
|
+
},{},...],
|
|
49
|
+
频道2:[{}],
|
|
50
|
+
频道3:[{}],
|
|
51
|
+
...
|
|
52
|
+
}",
|
|
53
|
+
"count": "频道内总人数"
|
|
54
|
+
}
|
|
55
|
+
```
|
package/lib/apps/ts3.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { QueryProtocol, TeamSpeak } from "ts3-nodejs-library";
|
|
2
|
-
import { config
|
|
2
|
+
import { config } from "../utils/index.js";
|
|
3
3
|
import karin, { logger, segment, app } from "node-karin";
|
|
4
4
|
import moment from "node-karin/moment";
|
|
5
5
|
import express from "node-karin/express";
|
|
@@ -200,10 +200,4 @@ router.get("/getAllUserList", async (req, res) => {
|
|
|
200
200
|
});
|
|
201
201
|
//将路由挂载到express实例中
|
|
202
202
|
app.use("/api/teamspeak", router);
|
|
203
|
-
//将静态资源挂载到express实例中 - 供外部单页应用网页部署时使用
|
|
204
|
-
app.use("/teamspeak", express.static(dirPath + "/resources/static"));
|
|
205
|
-
//供外部单页应用网页部署时使用 可用 ip:port/ts3 访问部署的网页
|
|
206
|
-
app.get("/teamspeak", (req, res) => {
|
|
207
|
-
res.sendFile(dirPath + "/resources/static/index.html");
|
|
208
|
-
});
|
|
209
203
|
export default teamspeak3;
|