PEP-131: voiceText takes the user after rebase onto feedback voice (PEP-143)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
4a30be42c4
commit
c49866d356
@ -626,7 +626,7 @@ export function createBot(o: BotOptions) {
|
||||
}
|
||||
|
||||
/** Text of a voice note; null — it could not be heard, and the user has been told. */
|
||||
async function voiceText(m: TgMessage): Promise<string | null> {
|
||||
async function voiceText(user: User, m: TgMessage): Promise<string | null> {
|
||||
const f = m.voice ?? m.audio!;
|
||||
const cfg = transcribeConfig();
|
||||
if (!cfg) return reply(m.chat.id, tr("Голосовые сообщения пока не работают. Напишите задачу текстом."), m.message_id).then(() => null);
|
||||
@ -649,7 +649,7 @@ export function createBot(o: BotOptions) {
|
||||
}
|
||||
|
||||
async function onVoice(user: User, m: TgMessage) {
|
||||
const text = await voiceText(m);
|
||||
const text = await voiceText(user, m);
|
||||
if (text) await onPlainText(user, m.chat.id, text, true);
|
||||
}
|
||||
|
||||
@ -685,7 +685,7 @@ export function createBot(o: BotOptions) {
|
||||
if (text.startsWith("/")) return closeFeedbackMode(db, user.id).then(() => "pass" as const);
|
||||
let said = text || m.caption?.trim() || "";
|
||||
if (!said && (m.voice || m.audio)) {
|
||||
const heard = await voiceText(m);
|
||||
const heard = await voiceText(user, m);
|
||||
if (!heard) return "done";
|
||||
said = heard;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user