mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 22:24:31 +00:00
feat(telegram): support inline button styles (#18241)
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: 239cb3552e
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus
This commit is contained in:
@@ -6,6 +6,7 @@ import type {
|
||||
} from "@grammyjs/types";
|
||||
import { type ApiClientOptions, Bot, HttpError, InputFile } from "grammy";
|
||||
import type { RetryConfig } from "../infra/retry.js";
|
||||
import type { TelegramInlineButtons } from "./button-types.js";
|
||||
import { loadConfig } from "../config/config.js";
|
||||
import { resolveMarkdownTableMode } from "../config/markdown-tables.js";
|
||||
import { logVerbose } from "../globals.js";
|
||||
@@ -55,7 +56,7 @@ type TelegramSendOpts = {
|
||||
/** Forum topic thread ID (for forum supergroups) */
|
||||
messageThreadId?: number;
|
||||
/** Inline keyboard buttons (reply markup). */
|
||||
buttons?: Array<Array<{ text: string; callback_data: string }>>;
|
||||
buttons?: TelegramInlineButtons;
|
||||
};
|
||||
|
||||
type TelegramSendResult = {
|
||||
@@ -404,6 +405,7 @@ export function buildInlineKeyboard(
|
||||
(button): InlineKeyboardButton => ({
|
||||
text: button.text,
|
||||
callback_data: button.callback_data,
|
||||
...(button.style ? { style: button.style } : {}),
|
||||
}),
|
||||
),
|
||||
)
|
||||
@@ -778,7 +780,7 @@ type TelegramEditOpts = {
|
||||
/** Controls whether link previews are shown in the edited message. */
|
||||
linkPreview?: boolean;
|
||||
/** Inline keyboard buttons (reply markup). Pass empty array to remove buttons. */
|
||||
buttons?: Array<Array<{ text: string; callback_data: string }>>;
|
||||
buttons?: TelegramInlineButtons;
|
||||
/** Optional config injection to avoid global loadConfig() (improves testability). */
|
||||
cfg?: ReturnType<typeof loadConfig>;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user