Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

179
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!