From 484b19ce3354ec2bda4c836b30b34e1ef77cd129 Mon Sep 17 00:00:00 2001 From: afjcjsbx Date: Thu, 19 Feb 2026 22:54:00 +0100 Subject: [PATCH] show_transcript in telegram voice input --- config/config.example.json | 3 ++- pkg/channels/telegram.go | 24 +++++++++++++----------- pkg/config/config.go | 16 +++++++++------- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/config/config.example.json b/config/config.example.json index 37c2bcd81..aee9dcd45 100644 --- a/config/config.example.json +++ b/config/config.example.json @@ -16,7 +16,8 @@ "proxy": "", "allow_from": [ "YOUR_USER_ID" - ] + ], + "show_transcript": true }, "discord": { "enabled": false, diff --git a/pkg/channels/telegram.go b/pkg/channels/telegram.go index 7f6cf8113..b194c8463 100644 --- a/pkg/channels/telegram.go +++ b/pkg/channels/telegram.go @@ -276,18 +276,20 @@ func (c *TelegramChannel) handleMessage(ctx context.Context, message *telego.Mes "text": result.Text, }) - replyText := fmt.Sprintf("Transcript: %s", escapeHTML(result.Text)) - replyMsg := tu.Message(tu.ID(chatID), replyText) - replyMsg.ReplyParameters = &telego.ReplyParameters{ - MessageID: message.MessageID, - } + if c.config.Channels.Telegram.ShowTranscript { + replyText := fmt.Sprintf("Transcript: %s", escapeHTML(result.Text)) + replyMsg := tu.Message(tu.ID(chatID), replyText) + replyMsg.ReplyParameters = &telego.ReplyParameters{ + MessageID: message.MessageID, + } + replyMsg.ParseMode = telego.ModeHTML - replyMsg.ParseMode = telego.ModeHTML - - if _, err := c.bot.SendMessage(ctx, replyMsg); err != nil { - logger.ErrorCF("telegram", "Failed to send transcription reply", map[string]interface{}{ - "error": err.Error(), - }) + _, replyErr := c.bot.SendMessage(ctx, replyMsg) + if replyErr != nil { + logger.ErrorCF("telegram", "Failed to send transcription reply", map[string]interface{}{ + "error": replyErr.Error(), + }) + } } } } else { diff --git a/pkg/config/config.go b/pkg/config/config.go index 682996bd6..725f85a52 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -171,10 +171,11 @@ type WhatsAppConfig struct { } type TelegramConfig struct { - Enabled bool `json:"enabled" env:"PICOCLAW_CHANNELS_TELEGRAM_ENABLED"` - Token string `json:"token" env:"PICOCLAW_CHANNELS_TELEGRAM_TOKEN"` - Proxy string `json:"proxy" env:"PICOCLAW_CHANNELS_TELEGRAM_PROXY"` - AllowFrom FlexibleStringSlice `json:"allow_from" env:"PICOCLAW_CHANNELS_TELEGRAM_ALLOW_FROM"` + Enabled bool `json:"enabled" env:"PICOCLAW_CHANNELS_TELEGRAM_ENABLED"` + Token string `json:"token" env:"PICOCLAW_CHANNELS_TELEGRAM_TOKEN"` + Proxy string `json:"proxy" env:"PICOCLAW_CHANNELS_TELEGRAM_PROXY"` + AllowFrom FlexibleStringSlice `json:"allow_from" env:"PICOCLAW_CHANNELS_TELEGRAM_ALLOW_FROM"` + ShowTranscript bool `json:"show_transcript" env:"PICOCLAW_CHANNELS_TELEGRAM_SHOW_TRANSCRIPT"` } type FeishuConfig struct { @@ -341,9 +342,10 @@ func DefaultConfig() *Config { AllowFrom: FlexibleStringSlice{}, }, Telegram: TelegramConfig{ - Enabled: false, - Token: "", - AllowFrom: FlexibleStringSlice{}, + Enabled: false, + Token: "", + AllowFrom: FlexibleStringSlice{}, + ShowTranscript: true, }, Feishu: FeishuConfig{ Enabled: false,