Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

289
Visualizações
How to make the bot not said the language code?

I'm trying to code discord tts bot but I run into a problem. When I used $speak en Hi guys the bot said "en hi guys".

I tried making the bot not say the language code but I can't so if you have any solution please share it with me.

Here is my code:

const { getAudioUrl } = require('google-tts-api')

let language = args[0]
 
if(!language) return message.reply("Please enter the language")     
if(!text) return message.reply("Please enter the text")
const text = args.join(" ")
 if(text.length > 200) return message.reply('You cant input a text with over 200 characters')
 const voiceChannel = message.member.voice.channel
 if(!voiceChannel) return message.reply(" Please enter a voice channel") 
                                    
 const audioURL = await getAudioUrl(text, {
 lang: language, 
 slow: false, 
 host: 'https://translate.google.com', 
 timeout: '150000'
 })

 try {
   voiceChannel.join().then(connection => {
     const dispatcher = connection.play(audioURL)
     dispatcher.on('finish', () => {
       voiceChannel.leave()
     })
   })
 }
about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You will need to remove the first item ("en") from your args array and join the rest:

const text = args.slice(1).join(" ")

if(!text) return message.reply("Please enter the text")
about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda