Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

292
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda