limit
parent
343c554109
commit
9bfcacae0f
|
@ -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',
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue