fix(help): centralize Telegram help output with shared command text (#566)
Co-authored-by: Letta Code <noreply@letta.com>
This commit is contained in:
@@ -22,6 +22,7 @@ import { basename } from 'node:path';
|
|||||||
import { buildAttachmentPath, downloadToFile } from './attachments.js';
|
import { buildAttachmentPath, downloadToFile } from './attachments.js';
|
||||||
import { applyTelegramGroupGating } from './telegram-group-gating.js';
|
import { applyTelegramGroupGating } from './telegram-group-gating.js';
|
||||||
import { resolveDailyLimits, checkDailyLimit, type GroupModeConfig } from './group-mode.js';
|
import { resolveDailyLimits, checkDailyLimit, type GroupModeConfig } from './group-mode.js';
|
||||||
|
import { HELP_TEXT } from '../core/commands.js';
|
||||||
|
|
||||||
import { createLogger } from '../logger.js';
|
import { createLogger } from '../logger.js';
|
||||||
|
|
||||||
@@ -250,17 +251,15 @@ export class TelegramAdapter implements ChannelAdapter {
|
|||||||
|
|
||||||
// Handle /start and /help
|
// Handle /start and /help
|
||||||
this.bot.command(['start', 'help'], async (ctx) => {
|
this.bot.command(['start', 'help'], async (ctx) => {
|
||||||
await ctx.reply(
|
const replyToMessageId =
|
||||||
"*LettaBot* - AI assistant with persistent memory\n\n" +
|
'message' in ctx && ctx.message
|
||||||
"*Commands:*\n" +
|
? String(ctx.message.message_id)
|
||||||
"/status - Show current status\n" +
|
: undefined;
|
||||||
"/model - Show current model and recommendations\n" +
|
await this.sendMessage({
|
||||||
"/reset - Reset conversation\n" +
|
chatId: String(ctx.chat.id),
|
||||||
"/cancel - Cancel active run\n" +
|
text: HELP_TEXT,
|
||||||
"/help - Show this message\n\n" +
|
replyToMessageId,
|
||||||
"Just send me a message to get started!",
|
});
|
||||||
{ parse_mode: 'Markdown' }
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Handle /status
|
// Handle /status
|
||||||
|
|||||||
@@ -106,8 +106,12 @@ describe('HELP_TEXT', () => {
|
|||||||
it('contains command descriptions', () => {
|
it('contains command descriptions', () => {
|
||||||
expect(HELP_TEXT).toContain('/status');
|
expect(HELP_TEXT).toContain('/status');
|
||||||
expect(HELP_TEXT).toContain('/heartbeat');
|
expect(HELP_TEXT).toContain('/heartbeat');
|
||||||
|
expect(HELP_TEXT).toContain('/reset');
|
||||||
|
expect(HELP_TEXT).toContain('/cancel');
|
||||||
expect(HELP_TEXT).toContain('/help');
|
expect(HELP_TEXT).toContain('/help');
|
||||||
|
expect(HELP_TEXT).toContain('/start');
|
||||||
expect(HELP_TEXT).toContain('/model');
|
expect(HELP_TEXT).toContain('/model');
|
||||||
|
expect(HELP_TEXT).toContain('/setconv');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('contains LettaBot branding', () => {
|
it('contains LettaBot branding', () => {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ Commands:
|
|||||||
/model <handle> - Switch to a different model
|
/model <handle> - Switch to a different model
|
||||||
/setconv <id> - Set conversation ID for this chat
|
/setconv <id> - Set conversation ID for this chat
|
||||||
/help - Show this message
|
/help - Show this message
|
||||||
|
/start - Show this message
|
||||||
|
|
||||||
Just send a message to get started!`;
|
Just send a message to get started!`;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user