@satorijs/adapter-lark 3.10.2 → 3.10.3
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.cjs +10 -6
- package/package.json +1 -1
- package/src/utils.ts +10 -6
package/lib/index.cjs
CHANGED
|
@@ -71,10 +71,12 @@ async function adaptMessage(bot, data, session, details = true) {
|
|
|
71
71
|
text.split(" ").forEach((word) => {
|
|
72
72
|
if (word.startsWith("@")) {
|
|
73
73
|
const mention = data.message.mentions.find((mention2) => mention2.key === word);
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
if (mention) {
|
|
75
|
+
content.push(import_core.h.at(mention.id.open_id, { name: mention.name }));
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
77
78
|
}
|
|
79
|
+
content.push(word);
|
|
78
80
|
});
|
|
79
81
|
break;
|
|
80
82
|
}
|
|
@@ -203,10 +205,12 @@ async function decodeMessage(bot, body, details = true) {
|
|
|
203
205
|
text.split(" ").forEach((word) => {
|
|
204
206
|
if (word.startsWith("@")) {
|
|
205
207
|
const mention = body.mentions.find((mention2) => mention2.key === word);
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
208
|
+
if (mention) {
|
|
209
|
+
content.push(import_core.h.at(mention.id, { name: mention.name }));
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
209
212
|
}
|
|
213
|
+
content.push(import_core.h.text(word));
|
|
210
214
|
});
|
|
211
215
|
break;
|
|
212
216
|
}
|
package/package.json
CHANGED
package/src/utils.ts
CHANGED
|
@@ -188,10 +188,12 @@ export async function adaptMessage<C extends Context = Context>(
|
|
|
188
188
|
text.split(' ').forEach((word) => {
|
|
189
189
|
if (word.startsWith('@')) {
|
|
190
190
|
const mention = data.message.mentions.find((mention) => mention.key === word)!
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
191
|
+
if (mention) {
|
|
192
|
+
content.push(h.at(mention.id.open_id, { name: mention.name }))
|
|
193
|
+
return
|
|
194
|
+
}
|
|
194
195
|
}
|
|
196
|
+
content.push(word)
|
|
195
197
|
})
|
|
196
198
|
break
|
|
197
199
|
}
|
|
@@ -327,10 +329,12 @@ export async function decodeMessage<C extends Context = Context>(bot: LarkBot<C>
|
|
|
327
329
|
text.split(' ').forEach((word) => {
|
|
328
330
|
if (word.startsWith('@')) {
|
|
329
331
|
const mention = body.mentions!.find((mention) => mention.key === word)!
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
332
|
+
if (mention) {
|
|
333
|
+
content.push(h.at(mention.id, { name: mention.name }))
|
|
334
|
+
return
|
|
335
|
+
}
|
|
333
336
|
}
|
|
337
|
+
content.push(h.text(word))
|
|
334
338
|
})
|
|
335
339
|
break
|
|
336
340
|
}
|