Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parse_mode selection feature for telegram client #1458

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
Open
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: "23"
node-version: "23.3.0"
cache: "pnpm"

- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integrationTests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: "23"
node-version: "23.3.0"
cache: "pnpm"

- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: 22
node-version: 23.3.0

- uses: pnpm/action-setup@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: "23"
node-version: "23.3.0"
cache: "pnpm"

- name: Run smoke tests
Expand Down
4 changes: 4 additions & 0 deletions docs/api/type-aliases/Character.md
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,10 @@ Optional client-specific config

> `optional` **teamMemberInterestKeywords**: `string`[]

### clientConfig.telegram.parseMode?

> `optional` **parseMode**: `"Markdown" | "MarkdownV2" | "HTML" | null`

### clientConfig.slack?

> `optional` **slack**: `object`
Expand Down
9 changes: 7 additions & 2 deletions packages/client-telegram/src/messageManager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { Message } from "@telegraf/types";
import { Context, Telegraf } from "telegraf";
import { composeContext, elizaLogger, ServiceType, composeRandomUser } from "@elizaos/core";
import {
composeContext,
elizaLogger,
ServiceType,
composeRandomUser,
} from "@elizaos/core";
import { getEmbeddingZeroVector } from "@elizaos/core";
import {
Content,
Expand Down Expand Up @@ -701,7 +706,7 @@ export class MessageManager {
i === 0 && replyToMessageId
? { message_id: replyToMessageId }
: undefined,
parse_mode: "Markdown",
parse_mode: this.runtime.character.clientConfig.telegram.parseMode || undefined,
}
)) as Message.TextMessage;

Expand Down
1 change: 1 addition & 0 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,7 @@ export type Character = {
teamAgentIds?: string[];
teamLeaderId?: string;
teamMemberInterestKeywords?: string[];
parseMode?: "Markdown" | "MarkdownV2" | "HTML" | null;
};
slack?: {
shouldIgnoreBotMessages?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion scripts/integrationTests.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# Check Node.js version
REQUIRED_NODE_VERSION=23
REQUIRED_NODE_VERSION=23.3.0
CURRENT_NODE_VERSION=$(node -v | cut -d'.' -f1 | sed 's/v//')

if (( CURRENT_NODE_VERSION < REQUIRED_NODE_VERSION )); then
Expand Down
Loading