From 9bfcacae0f5b982ac12f92a18d0b4f53bf37198b Mon Sep 17 00:00:00 2001 From: Matthew R Date: Wed, 25 Nov 2020 01:30:45 -0500 Subject: [PATCH] limit --- src/commands/tts.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commands/tts.ts b/src/commands/tts.ts index d2ac21c..940fde7 100644 --- a/src/commands/tts.ts +++ b/src/commands/tts.ts @@ -17,10 +17,11 @@ export default class TTS extends Command { public async run(message: Message, args: string[]) { try { if (!args[0]) return this.client.commands.get('help').run(message, [this.name]); + if (args.length > 200) return this.error(message.channel, 'Cannot synthesize more than 200 characters.'); const msg = await this.loading(message.channel, 'Synthesizing...'); const d = await axios({ method: 'GET', - url: `https://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&q=${args.join(' ')}&tl=en`, + url: `https://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&q=${encodeURIComponent(args.join(' '))}&tl=en`, headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0', },