Skip to content

Commit 6893d90

Browse files
authored
fix(telegram): markdown not being correctly set and release (#679)
* fix markdown * update workflow * fix * fix * fix
1 parent 020391d commit 6893d90

File tree

8 files changed

+25
-15
lines changed

8 files changed

+25
-15
lines changed

.github/workflows/build.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Set up Docker Buildx
2929
uses: docker/setup-buildx-action@v1
3030
- name: Cache Docker layers
31-
uses: actions/cache@v2
31+
uses: actions/cache@v4
3232
with:
3333
path: /tmp/.buildx-cache
3434
key: ${{ runner.os }}-buildx-${{ github.sha }}
@@ -59,7 +59,7 @@ jobs:
5959
steps:
6060
- name: Checkout code
6161
uses: actions/checkout@master
62-
- uses: actions/setup-node@v2
62+
- uses: actions/setup-node@v3
6363
with:
6464
node-version-file: '.nvmrc'
6565
cache: 'yarn'

.github/workflows/tests.yml

+11-6
Original file line numberDiff line numberDiff line change
@@ -164,25 +164,30 @@ jobs:
164164
runs-on: ubuntu-latest
165165
strategy:
166166
matrix:
167-
browser: ['chrome', 'firefox']
167+
browser: ['chrome']
168168

169169
steps:
170170
- name: Checkout code
171171
uses: actions/checkout@master
172-
- uses: actions/setup-node@v2
172+
- uses: actions/setup-node@v3
173173
with:
174174
node-version-file: '.nvmrc'
175175
cache: 'yarn'
176+
177+
- name: Install Firefox
178+
run: sudo apt-get install -y firefox
179+
180+
- name: Upgrade Cypress
181+
run: yarn add cypress@latest --dev
182+
176183
- name: Fetch Node Packages
177184
run: |
178185
yarn --immutable
179186
yarn build
180187
181188
- name: Run e2e tests
182-
run: |
183-
yarn test:chat:${{ matrix.browser }}
189+
run: xvfb-run --auto-servernum yarn test:chat:${{ matrix.browser }}
184190

185191
- name: Run unit tests
186192
working-directory: ./packages/inject
187-
run: |
188-
yarn test
193+
run: yarn test

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16
1+
v16.14.0

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@botpress/messaging",
3-
"version": "1.2.17",
3+
"version": "1.2.18",
44
"description": "Botpress messaging repo",
55
"author": "Botpress, Inc.",
66
"license": "AGPL-3.0",

packages/channels/src/content/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export interface CardContent extends Content {
4848
subtitle?: string
4949
image?: string
5050
actions: ActionButton[]
51+
markdown?: boolean
5152
}
5253

5354
export interface LocationContent extends Content {

packages/channels/src/telegram/renderers/carousel.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class TelegramCarouselRenderer extends CarouselRenderer {
3030
}
3131

3232
endRenderCard(context: Context, card: CardContent) {
33-
const text = `*${card.title}*${card.subtitle ? '\n' + card.subtitle : ''}`
33+
const text = `${card.title}${card.subtitle ? '\n' + card.subtitle : ''}`
3434

3535
if (card.image) {
3636
context.channel.messages.push({ action: 'upload_photo' })
@@ -39,12 +39,16 @@ export class TelegramCarouselRenderer extends CarouselRenderer {
3939
url: card.image,
4040
filename: path.basename(card.image)
4141
},
42-
extra: { caption: text, parse_mode: 'Markdown', ...Markup.inlineKeyboard(context.buttons) }
42+
extra: {
43+
caption: text,
44+
...(card.markdown && { parse_mode: 'Markdown' }),
45+
...Markup.inlineKeyboard(context.buttons)
46+
}
4347
})
4448
} else {
4549
context.channel.messages.push({
4650
text,
47-
extra: Markup.inlineKeyboard(context.buttons)
51+
extra: { ...(card.markdown && { parse_mode: 'Markdown' }), ...Markup.inlineKeyboard(context.buttons) }
4852
})
4953
}
5054
}

packages/channels/src/telegram/renderers/choices.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ export class TelegramChoicesRenderer extends ChoicesRenderer {
1010
}
1111

1212
const buttons = payload.choices.map((x) => Markup.button.callback(x.title, x.value))
13-
context.messages[0].extra = Markup.keyboard(buttons).oneTime()
13+
context.messages[0].extra = { ...context.messages[0].extra, ...Markup.keyboard(buttons).oneTime() }
1414
}
1515
}

packages/server/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@botpress/messaging-server",
3-
"version": "1.2.17",
3+
"version": "1.2.18",
44
"main": "index.ts",
55
"license": "AGPL-3.0",
66
"scripts": {

0 commit comments

Comments
 (0)