Merge 91fa76fd4f into 4583f88626
This commit is contained in:
commit
2da09fa045
@ -19,3 +19,14 @@ export function formatCliCommand(
|
||||
}
|
||||
return normalizedCommand.replace(CLI_PREFIX_RE, (match) => `${match} --profile ${profile}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a CLI command wrapped in backticks for one-click copy in Telegram.
|
||||
* When sent as a message, users can tap the monospace text to copy it.
|
||||
*/
|
||||
export function formatCliCommandForCopy(
|
||||
command: string,
|
||||
env: Record<string, string | undefined> = process.env as Record<string, string | undefined>,
|
||||
): string {
|
||||
return `\`${formatCliCommand(command, env)}\``;
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ import { finalizeInboundContext } from "../auto-reply/reply/inbound-context.js";
|
||||
import { buildMentionRegexes, matchesMentionWithExplicit } from "../auto-reply/reply/mentions.js";
|
||||
import { formatLocationText, toLocationContext } from "../channels/location.js";
|
||||
import { recordInboundSession } from "../channels/session.js";
|
||||
import { formatCliCommand } from "../cli/command-format.js";
|
||||
import { formatCliCommandForCopy } from "../cli/command-format.js";
|
||||
import { readSessionUpdatedAt, resolveStorePath } from "../config/sessions.js";
|
||||
import type { MoltbotConfig } from "../config/config.js";
|
||||
import type { DmPolicy, TelegramGroupConfig, TelegramTopicConfig } from "../config/types.js";
|
||||
@ -279,8 +279,9 @@ export const buildTelegramMessageContext = async ({
|
||||
`Pairing code: ${code}`,
|
||||
"",
|
||||
"Ask the bot owner to approve with:",
|
||||
formatCliCommand("moltbot pairing approve telegram <code>"),
|
||||
formatCliCommandForCopy(`moltbot pairing approve telegram ${code}`),
|
||||
].join("\n"),
|
||||
{ parse_mode: "Markdown" },
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user