pull/29/head
Matthew 2020-11-25 01:30:45 -05:00
parent 343c554109
commit 9bfcacae0f
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 2 additions and 1 deletions

View File

@ -17,10 +17,11 @@ export default class TTS extends Command {
public async run(message: Message, args: string[]) { public async run(message: Message, args: string[]) {
try { try {
if (!args[0]) return this.client.commands.get('help').run(message, [this.name]); 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 msg = await this.loading(message.channel, 'Synthesizing...');
const d = await axios({ const d = await axios({
method: 'GET', 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: { headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0',
}, },