Skip to content

Commit

Permalink
feat: add p and br support
Browse files Browse the repository at this point in the history
support for `lark`, `line` and `qqguild`
  • Loading branch information
Seidko authored Sep 1, 2023
1 parent e27ed48 commit 7a60002
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions adapters/lark/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ export class LarkMessageEncoder extends MessageEncoder<LarkBot> {
await this.render(children)
if (attrs.href) this.content += ` (${attrs.href})`
break
case 'p':
if (!this.content.endsWith('\n')) this.content += '\n'
await this.render(children)
break
case 'br':
this.content += '\n'
case 'sharp':

Check failure on line 156 in adapters/lark/src/message.ts

View workflow job for this annotation

GitHub Actions / lint

Expected a 'break' statement before 'case'
// platform does not support sharp
break
Expand Down
5 changes: 5 additions & 0 deletions adapters/line/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ export class LineMessageEncoder extends MessageEncoder<LineBot> {

if (type === 'text') {
this.buffer += attrs.content
} else if (type === 'br') {
this.buffer += '\n'
} else if (type === 'p') {
if (!this.buffer.endsWith('\n')) this.buffer += '\n'
await this.render(children)
} else if (type === 'image' && attrs.url) {
await this.insertBlock()
this.blocks.push({
Expand Down
5 changes: 5 additions & 0 deletions adapters/qqguild/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ export class QQGuildMessageEncoder extends MessageEncoder<QQGuildBot> {
default:
this.content += `<@${attrs.id}>`
}
} else if (type === 'br') {
this.content += '\n'
} else if (type === 'p') {
if (!this.content.endsWith('\n')) this.content += '\n'
await this.render(children)
} else if (type === 'sharp') {
this.content += `<#${attrs.id}>`
} else if (type === 'quote') {
Expand Down

0 comments on commit 7a60002

Please sign in to comment.