Skip to content

Commit

Permalink
fix: fix p behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Seidko authored Sep 1, 2023
1 parent 0cfb401 commit ece0ec2
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions adapters/dingtalk/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export class DingtalkMessageEncoder extends MessageEncoder<DingtalkBot> {
} else if (type === 'p') {
if (!this.buffer.endsWith('\n')) this.buffer += '\n'
await this.render(children)
if (!this.buffer.endsWith('\n')) this.buffer += '\n'
this.buffer += '\n'
} else if (type === 'b' || type === 'strong') {
this.buffer += ` **`
Expand Down
1 change: 1 addition & 0 deletions adapters/discord/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ export class DiscordMessageEncoder extends MessageEncoder<DiscordBot> {
} else if (type === 'p') {
if (!this.buffer.endsWith('\n')) this.buffer += '\n'
await this.render(children)
if (!this.buffer.endsWith('\n')) this.buffer += '\n'
this.buffer += '\n'
} else if (type === 'blockquote') {
if (!this.buffer.endsWith('\n')) this.buffer += '\n'
Expand Down
1 change: 1 addition & 0 deletions adapters/kook/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ export class KookMessageEncoder extends MessageEncoder<KookBot> {
} else if (type === 'p') {
if (!this.buffer.endsWith('\n')) this.buffer += '\n'
await this.render(children)
if (!this.buffer.endsWith('\n')) this.buffer += '\n'
} else if (type === 'at') {
if (attrs.id) {
this.buffer += `(met)${attrs.id}(met)`
Expand Down
1 change: 1 addition & 0 deletions adapters/lark/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export class LarkMessageEncoder extends MessageEncoder<LarkBot> {
case 'p':
if (!this.content.endsWith('\n')) this.content += '\n'
await this.render(children)
if (!this.content.endsWith('\n')) this.content += '\n'
break
case 'br':
this.content += '\n'
Expand Down
1 change: 1 addition & 0 deletions adapters/line/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export class LineMessageEncoder extends MessageEncoder<LineBot> {
} else if (type === 'p') {
if (!this.buffer.endsWith('\n')) this.buffer += '\n'
await this.render(children)
if (!this.buffer.endsWith('\n')) this.buffer += '\n'
} else if (type === 'image' && attrs.url) {
await this.insertBlock()
this.blocks.push({
Expand Down
1 change: 1 addition & 0 deletions adapters/matrix/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export class MatrixMessageEncoder extends MessageEncoder<MatrixBot> {
} else if (type === 'p') {
if (!this.buffer.endsWith('\n')) this.buffer += '\n'
await this.render(children)
if (!this.buffer.endsWith('\n')) this.buffer += '\n'
} else if (type === 'at') {
if (attrs.id) {
this.buffer += ` @${attrs.id} `
Expand Down
1 change: 1 addition & 0 deletions adapters/qqguild/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export class QQGuildMessageEncoder extends MessageEncoder<QQGuildBot> {
} else if (type === 'p') {
if (!this.content.endsWith('\n')) this.content += '\n'
await this.render(children)
if (!this.content.endsWith('\n')) this.content += '\n'
} else if (type === 'sharp') {
this.content += `<#${attrs.id}>`
} else if (type === 'quote') {
Expand Down
1 change: 1 addition & 0 deletions adapters/slack/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export class SlackMessageEncoder extends MessageEncoder<SlackBot> {
} else if (type === 'p') {
if (!this.buffer.endsWith('\n')) this.buffer += `\n`
await this.render(children)
if (!this.buffer.endsWith('\n')) this.buffer += `\n`
} else if (type === 'face') {
this.buffer += `:${attrs.id}:`
} else if (type === 'author') {
Expand Down
1 change: 1 addition & 0 deletions adapters/telegram/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export class TelegramMessageEncoder extends MessageEncoder<TelegramBot> {
} else if (type === 'p') {
if (!this.payload.caption.endsWith('\n')) this.payload.caption += '\n'
await this.render(children)
if (!this.payload.caption.endsWith('\n')) this.payload.caption += '\n'
} else if (supportedElements.includes(type)) {
this.payload.caption += element.toString()
} else if (type === 'spl') {
Expand Down
1 change: 1 addition & 0 deletions adapters/wechat-official/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export class WechatOfficialMessageEncoder extends MessageEncoder<WechatOfficialB
} else if (type === 'p') {
if (!this.buffer.endsWith('\n')) this.buffer += '\n'
await this.render(children)
if (!this.buffer.endsWith('\n')) this.buffer += '\n'
} else if (type === 'image' || type === 'audio' || type === 'video') {
await this.flushMedia(element)
} else if (type === 'message') {
Expand Down
1 change: 1 addition & 0 deletions adapters/wecom/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export class WecomMessageEncoder extends MessageEncoder<WecomBot> {
} else if (type === 'p') {
if (!this.buffer.endsWith('\n')) this.buffer += '\n'
await this.render(children)
if (!this.buffer.endsWith('\n')) this.buffer += '\n'
} else if (type === 'image' || type === 'audio' || type === 'video' || type === 'file') {
await this.flushMedia(element)
} else if (type === 'a' && attrs.href) {
Expand Down
1 change: 1 addition & 0 deletions adapters/whatsapp/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export class WhatsAppMessageEncoder extends MessageEncoder<WhatsAppBot> {
} else if (type === 'p') {
if (!this.buffer.endsWith('\n')) this.buffer += '\n'
await this.render(children)
if (!this.buffer.endsWith('\n')) this.buffer += '\n'
} else if (type === 'a') {
await this.render(children)
this.buffer += ` (${attrs.href}) `
Expand Down

0 comments on commit ece0ec2

Please sign in to comment.