Skip to content

Commit

Permalink
fix(lark): different <at> syntax for post and interactive
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Jan 10, 2025
1 parent 82dbae3 commit 815009a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion adapters/lark/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@satorijs/adapter-lark",
"description": "Lark (飞书) Adapter for Satorijs",
"version": "3.9.4",
"version": "3.9.5",
"type": "module",
"main": "lib/index.cjs",
"types": "lib/index.d.ts",
Expand Down
14 changes: 11 additions & 3 deletions adapters/lark/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,18 @@ export class LarkMessageEncoder<C extends Context = Context> extends MessageEnco
if (type === 'text') {
this.textContent += attrs.content
} else if (type === 'at') {
if (attrs.type === 'all') {
this.textContent += `<at user_id="all">${attrs.name ?? '所有人'}</at>`
if (this.card) {
if (attrs.type === 'all') {
this.textContent += `<at id=all>${attrs.name ?? ''}</at>`
} else {
this.textContent += `<at id=${attrs.id}>${attrs.name ?? ''}</at>`
}
} else {
this.textContent += `<at user_id="${attrs.id}">${attrs.name}</at>`
if (attrs.type === 'all') {
this.textContent += `<at user_id="all">${attrs.name ?? ''}</at>`
} else {
this.textContent += `<at user_id="${attrs.id}">${attrs.name ?? ''}</at>`
}
}
} else if (type === 'a') {
await this.render(children)
Expand Down

0 comments on commit 815009a

Please sign in to comment.