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

178
Vistas
How do i make my discord bot type in a specific channel while someone is typing in the bots dms?

I want my discord bot to type in a specific channel while an user is typing in the bots dms to make it look like the user is typing through the bot. I've managed to make it so my bot starts typing in the channel whenever someone is typing in the bots dms but it doesn't stop when the user stops typing yet

Thank you for you help

I now want the bot to do it the other way around which is why I added the following few lines to the code. It doesn't work yet. The error message goes as follows: "(node:38868) UnhandledPromiseRejectionWarning: TypeError: dmToTypeIn.startTyping is not a function"

Client.on("typingStart", async function(channel, user){
    if(user.bot){
        return;
    }

    let channelToTypeIn = Client.channels.cache.get(openTicketsByUserID[user.id].ticketID)
    if(channel.type === "dm"){
        if(openTicketsByUserID[user.id]){

            console.log("one")
            channelToTypeIn.startTyping()

        } else{
            return;
        }   
    }
    
})

The new code:

Client.on("typingStart", async function(channel, user) {

    function Sleep(milliseconds) {
        return new Promise(resolve => setTimeout(resolve, milliseconds));
    }


    if (channel.type === "dm") {

        if (openTicketsByUserID[user.id]) {
            let channelToTypeIn = Client.channels.cache.get(openTicketsByUserID[user.id].ticketID);
            channelToTypeIn.startTyping();
        }
        let fulfilled = false;
        while (!fulfilled) {
            if (!user.typingIn(user.dmChannel)) {
                let channelToTypeIn = Client.channels.cache.get(openTicketsByUserID[user.id].ticketID);
                fulfilled = true;
                channelToTypeIn.stopTyping(true);
            }
        }     
    }

↓↓↓ The part that isn't working yet ↓↓↓

    if(openTicketsByChannelID[channel.id]){
        let dmToTypeIn = Client.users.fetch(openTicketsByChannelID[channel.id].userID)
        dmToTypeIn.startTyping();
    }
    let fulfilled = false;
    while(!fulfilled){
        if(!user.typingIn(channel)){
            let dmToTypeIn = Client.channels.get(openTicketsByChannelID[channel.id].userID)
            fulfilled = true;
            dmToTypeIn.stopTyping(true);
        }
    }

});
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You have to check if the user is typing with the User.typingIn method

Client.on("typingStart", async function(channel, user) {
    if (user.bot) {
        return;
    }

    let channelToTypeIn = Client.channels.cache.get(openTicketsByUserID[user.id].ticketID);
    if (channel.type === "dm") {
        if (openTicketsByUserID[user.id]) {
            channelToTypeIn.startTyping();
        }  
    }
   let fulfilled = false;
    while (!fulfilled) {
        if (!user.typingIn(user.dmChannel)) {
            fulfilled = true;
            channelToTypeIn.stopTyping(true);
        }
    } 
});

You can actually use this to make your own custom event!

Client.on("typingStart", async (channel, user) => {
    let fulfilled = false;
        while (!fulfilled) {
            if (!user.typingIn(channel)) {
                fulfilled = true;
                Client.emit("typingStop", channel, user)
            }
    }
})

And listen with

Client.on("typingStop", async (channel, user) => {
//code for when user stops typing
})
about 4 years ago · Juan Pablo Isaza 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