@alemonjs/onebot 0.0.2 → 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/lib/index-11.js +12 -3
- package/lib/index-12.js +12 -3
- package/package.json +3 -6
package/lib/index-11.js
CHANGED
|
@@ -48,6 +48,9 @@ var INDEXV11 = defineBot(() => {
|
|
|
48
48
|
IsMaster: uis.includes(String(event.user_id)),
|
|
49
49
|
// 用户ID
|
|
50
50
|
UserId: String(event.user_id),
|
|
51
|
+
GuildIdName: '',
|
|
52
|
+
GuildIdAvatar: '',
|
|
53
|
+
ChannelName: '',
|
|
51
54
|
// 用户名
|
|
52
55
|
UserName: event.sender.nickname,
|
|
53
56
|
// 用户头像
|
|
@@ -55,7 +58,7 @@ var INDEXV11 = defineBot(() => {
|
|
|
55
58
|
// 格式化数据
|
|
56
59
|
MsgId: String(event.message_id),
|
|
57
60
|
// 用户消息
|
|
58
|
-
|
|
61
|
+
MessageBody: [
|
|
59
62
|
Text(msg),
|
|
60
63
|
...at_users.map(item => At(item.id, 'user', {
|
|
61
64
|
name: item.name,
|
|
@@ -63,6 +66,8 @@ var INDEXV11 = defineBot(() => {
|
|
|
63
66
|
bot: item.bot
|
|
64
67
|
}))
|
|
65
68
|
],
|
|
69
|
+
MessageText: msg,
|
|
70
|
+
// 用户openId
|
|
66
71
|
// 用户openId
|
|
67
72
|
OpenID: String(event.user_id),
|
|
68
73
|
// 创建时间
|
|
@@ -105,7 +110,9 @@ var INDEXV11 = defineBot(() => {
|
|
|
105
110
|
send: (event, val) => {
|
|
106
111
|
if (val.length < 0)
|
|
107
112
|
return Promise.all([]);
|
|
108
|
-
const content = useParse(
|
|
113
|
+
const content = useParse({
|
|
114
|
+
MessageBody: val
|
|
115
|
+
}, 'Text');
|
|
109
116
|
if (content) {
|
|
110
117
|
return Promise.all([content].map(item => client.sendGroupMsg({
|
|
111
118
|
group_id: event.ChannelId,
|
|
@@ -119,7 +126,9 @@ var INDEXV11 = defineBot(() => {
|
|
|
119
126
|
]
|
|
120
127
|
})));
|
|
121
128
|
}
|
|
122
|
-
const images = useParse(
|
|
129
|
+
const images = useParse({
|
|
130
|
+
MessageBody: val
|
|
131
|
+
}, 'Image');
|
|
123
132
|
if (images) {
|
|
124
133
|
return Promise.all(images.map(item => client.sendGroupMsg({
|
|
125
134
|
group_id: event.ChannelId,
|
package/lib/index-12.js
CHANGED
|
@@ -68,12 +68,15 @@ var INDEXV12 = defineBot(() => {
|
|
|
68
68
|
UserId: event.user_id,
|
|
69
69
|
// 用户名
|
|
70
70
|
UserName: event.sender.nickname,
|
|
71
|
+
GuildIdName: '',
|
|
72
|
+
GuildIdAvatar: '',
|
|
73
|
+
ChannelName: '',
|
|
71
74
|
// 用户头像
|
|
72
75
|
UserAvatar: event.platform == 'qq' ? `https://q1.qlogo.cn/g?b=qq&s=0&nk=${event.user_id}` : '',
|
|
73
76
|
// 格式化数据
|
|
74
77
|
MsgId: event.message_id,
|
|
75
78
|
// 用户消息
|
|
76
|
-
|
|
79
|
+
MessageBody: [
|
|
77
80
|
Text(msg),
|
|
78
81
|
...at_users.map(item => At(item.id, 'user', {
|
|
79
82
|
name: item.name,
|
|
@@ -81,6 +84,8 @@ var INDEXV12 = defineBot(() => {
|
|
|
81
84
|
bot: item.bot
|
|
82
85
|
}))
|
|
83
86
|
],
|
|
87
|
+
MessageText: msg,
|
|
88
|
+
// 表情
|
|
84
89
|
// 用户openId
|
|
85
90
|
OpenID: event.user_id,
|
|
86
91
|
//
|
|
@@ -123,7 +128,9 @@ var INDEXV12 = defineBot(() => {
|
|
|
123
128
|
send: (event, val) => {
|
|
124
129
|
if (val.length < 0)
|
|
125
130
|
return Promise.all([]);
|
|
126
|
-
const content = useParse(
|
|
131
|
+
const content = useParse({
|
|
132
|
+
MessageBody: val
|
|
133
|
+
}, 'Text');
|
|
127
134
|
if (content) {
|
|
128
135
|
return Promise.all([content].map(item => client.sendGroupMsg({
|
|
129
136
|
group_id: event.ChannelId,
|
|
@@ -137,7 +144,9 @@ var INDEXV12 = defineBot(() => {
|
|
|
137
144
|
]
|
|
138
145
|
})));
|
|
139
146
|
}
|
|
140
|
-
const images = useParse(
|
|
147
|
+
const images = useParse({
|
|
148
|
+
MessageBody: val
|
|
149
|
+
}, 'Image');
|
|
141
150
|
if (images) {
|
|
142
151
|
return Promise.all(images.map(item => client.sendGroupMsg({
|
|
143
152
|
group_id: event.ChannelId,
|
package/package.json
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alemonjs/onebot",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "onebot",
|
|
5
5
|
"author": "lemonade",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"chat-space": "^0.0.6"
|
|
11
|
-
},
|
|
12
9
|
"types": "lib",
|
|
13
10
|
"exports": {
|
|
14
11
|
".": {
|
|
@@ -26,9 +23,9 @@
|
|
|
26
23
|
"registry": "https://registry.npmjs.org",
|
|
27
24
|
"access": "public"
|
|
28
25
|
},
|
|
29
|
-
"bugs": "https://github.com/
|
|
26
|
+
"bugs": "https://github.com/lemonade-lab/alemonjs/issues",
|
|
30
27
|
"repository": {
|
|
31
28
|
"type": "git",
|
|
32
|
-
"url": "https://github.com/
|
|
29
|
+
"url": "https://github.com/lemonade-lab/alemonjs.git"
|
|
33
30
|
}
|
|
34
31
|
}
|