feat(cli): show Telegram bot username in status
This commit is contained in:
@@ -6,6 +6,7 @@ Docs: https://docs.clawd.bot
|
|||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
- Dependencies: update core + plugin deps (grammy, vitest, openai, Microsoft agents hosting, etc.).
|
- Dependencies: update core + plugin deps (grammy, vitest, openai, Microsoft agents hosting, etc.).
|
||||||
|
- CLI: show Telegram bot username in channel status (probe/runtime).
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
- Configure: hide OpenRouter auto routing model from the model picker. (#1182) — thanks @zerone0x.
|
- Configure: hide OpenRouter auto routing model from the model picker. (#1182) — thanks @zerone0x.
|
||||||
|
|||||||
@@ -417,6 +417,22 @@ describe("channels command", () => {
|
|||||||
expect(lines.join("\n")).toMatch(/Telegram Bot API privacy mode/i);
|
expect(lines.join("\n")).toMatch(/Telegram Bot API privacy mode/i);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("includes Telegram bot username from probe data", () => {
|
||||||
|
const lines = formatGatewayChannelsStatusLines({
|
||||||
|
channelAccounts: {
|
||||||
|
telegram: [
|
||||||
|
{
|
||||||
|
accountId: "default",
|
||||||
|
enabled: true,
|
||||||
|
configured: true,
|
||||||
|
probe: { ok: true, bot: { username: "clawdbot_bot" } },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
expect(lines.join("\n")).toMatch(/bot:@clawdbot_bot/);
|
||||||
|
});
|
||||||
|
|
||||||
it("surfaces Telegram group membership audit issues in channels status output", () => {
|
it("surfaces Telegram group membership audit issues in channels status output", () => {
|
||||||
const lines = formatGatewayChannelsStatusLines({
|
const lines = formatGatewayChannelsStatusLines({
|
||||||
channelAccounts: {
|
channelAccounts: {
|
||||||
|
|||||||
@@ -51,6 +51,18 @@ export function formatGatewayChannelsStatusLines(payload: Record<string, unknown
|
|||||||
if (typeof account.mode === "string" && account.mode.length > 0) {
|
if (typeof account.mode === "string" && account.mode.length > 0) {
|
||||||
bits.push(`mode:${account.mode}`);
|
bits.push(`mode:${account.mode}`);
|
||||||
}
|
}
|
||||||
|
const botUsername = (() => {
|
||||||
|
const bot = account.bot as { username?: string | null } | undefined;
|
||||||
|
const probeBot = (account.probe as { bot?: { username?: string | null } } | undefined)?.bot;
|
||||||
|
const raw = bot?.username ?? probeBot?.username ?? "";
|
||||||
|
if (typeof raw !== "string") return "";
|
||||||
|
const trimmed = raw.trim();
|
||||||
|
if (!trimmed) return "";
|
||||||
|
return trimmed.startsWith("@") ? trimmed : `@${trimmed}`;
|
||||||
|
})();
|
||||||
|
if (botUsername) {
|
||||||
|
bits.push(`bot:${botUsername}`);
|
||||||
|
}
|
||||||
if (typeof account.dmPolicy === "string" && account.dmPolicy.length > 0) {
|
if (typeof account.dmPolicy === "string" && account.dmPolicy.length > 0) {
|
||||||
bits.push(`dm:${account.dmPolicy}`);
|
bits.push(`dm:${account.dmPolicy}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user