@alemonjs/onebot 0.0.1 → 0.0.2
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 +1 -1
- package/lib/index-12.js +20 -14
- package/lib/sdk-v12/wss.js +14 -7
- package/package.json +1 -1
package/lib/index-11.js
CHANGED
package/lib/index-12.js
CHANGED
|
@@ -125,25 +125,31 @@ var INDEXV12 = defineBot(() => {
|
|
|
125
125
|
return Promise.all([]);
|
|
126
126
|
const content = useParse(val, 'Text');
|
|
127
127
|
if (content) {
|
|
128
|
-
return Promise.all([content].map(item => client.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
128
|
+
return Promise.all([content].map(item => client.sendGroupMsg({
|
|
129
|
+
group_id: event.ChannelId,
|
|
130
|
+
message: [
|
|
131
|
+
{
|
|
132
|
+
type: 'text',
|
|
133
|
+
data: {
|
|
134
|
+
text: item
|
|
135
|
+
}
|
|
133
136
|
}
|
|
134
|
-
|
|
135
|
-
|
|
137
|
+
]
|
|
138
|
+
})));
|
|
136
139
|
}
|
|
137
140
|
const images = useParse(val, 'Image');
|
|
138
141
|
if (images) {
|
|
139
|
-
return Promise.all(images.map(item => client.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
return Promise.all(images.map(item => client.sendGroupMsg({
|
|
143
|
+
group_id: event.ChannelId,
|
|
144
|
+
message: [
|
|
145
|
+
{
|
|
146
|
+
type: 'image',
|
|
147
|
+
data: {
|
|
148
|
+
file_id: item
|
|
149
|
+
}
|
|
144
150
|
}
|
|
145
|
-
|
|
146
|
-
|
|
151
|
+
]
|
|
152
|
+
})));
|
|
147
153
|
}
|
|
148
154
|
return Promise.all([]);
|
|
149
155
|
}
|
package/lib/sdk-v12/wss.js
CHANGED
|
@@ -96,17 +96,24 @@ class OneBotClient {
|
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
98
|
*
|
|
99
|
-
* @param
|
|
100
|
-
* @param message
|
|
99
|
+
* @param options
|
|
101
100
|
* @returns
|
|
102
101
|
*/
|
|
103
|
-
|
|
102
|
+
sendGroupMsg(options) {
|
|
104
103
|
return this.#ws.send(JSON.stringify({
|
|
105
104
|
action: 'send_group_msg',
|
|
106
|
-
params:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
params: options,
|
|
106
|
+
echo: '1234'
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* @param options
|
|
111
|
+
* @returns
|
|
112
|
+
*/
|
|
113
|
+
sendPrivateMsg(options) {
|
|
114
|
+
return this.#ws.send(JSON.stringify({
|
|
115
|
+
action: 'send_private_msg',
|
|
116
|
+
params: options,
|
|
110
117
|
echo: '1234'
|
|
111
118
|
}));
|
|
112
119
|
}
|