From b34510a32f9bd51ff1a81994db2f905dc189c63a Mon Sep 17 00:00:00 2001 From: Danil Nikolaev Date: Sun, 18 Jan 2026 16:34:34 +0300 Subject: [PATCH] transliteration now uses reply if it is present --- src/commands/transliteration.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/commands/transliteration.ts b/src/commands/transliteration.ts index c4e937c..41d73b2 100644 --- a/src/commands/transliteration.ts +++ b/src/commands/transliteration.ts @@ -98,10 +98,20 @@ export function fixLayoutAuto( } export class Transliteration extends ChatCommand { - regexp = /^\/tr\s([^]+)/i; + regexp = /^\/tr/i; + + async execute(msg: Message): Promise { + let text: string = ""; + + if (msg.reply_to_message) { + text = (msg.reply_to_message.text || msg.reply_to_message.caption || ""); + } else { + const split = (msg.text || msg.caption).split("/tr "); + if (split.length > 1) { + text = split[1].trim(); + } + } - async execute(msg: Message, match?: RegExpExecArray): Promise { - const text = (match ? match[1] : "").trim(); if (text.length === 0) { return; }