Skip to content

Commit 63f9a86

Browse files
authored
now supports reply (#95)
1 parent 68c0bf6 commit 63f9a86

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

tts/tts.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@
2424

2525
gTTS = import_library("gtts").gTTS
2626

27-
2827
@Client.on_message(filters.command("tts", prefix) & filters.me)
2928
async def tts(client: Client, message: Message):
30-
lang = message.command[1]
31-
text = " ".join(message.command[2:])
29+
if message.reply_to_message:
30+
lang = message.command[1]
31+
text = message.reply_to_message.text
32+
else:
33+
lang = message.command[1]
34+
text = " ".join(message.command[2:])
35+
3236
await message.edit("<b>Speech synthesis...</b>", parse_mode=enums.ParseMode.HTML)
3337

3438
try:
@@ -45,5 +49,7 @@ async def tts(client: Client, message: Message):
4549
except Exception as e:
4650
await message.edit(format_exc(e), parse_mode=enums.ParseMode.HTML)
4751

48-
49-
modules_help["tts"] = {"tts [lang]* [text]*": "Say text"}
52+
modules_help["tts"] = {
53+
"tts [lang]* [text]*": "Say text",
54+
"tts [lang]* replied message": "Say text"
55+
}

0 commit comments

Comments
 (0)