Ad
How To Send Discord Messages Over A Period Of Seconds As Opposed To Instantly Or Make It Seem Like The Bot Is Typing For A While
I have a discord bot that uses Discord.js
. It can send messages instantly using code like
message.channel.send('hi')
This works just fine for sending normal messages but I would like to make it seem like it's taking a while to type (Not dissimilar to how the bot Chatty Cathy sends human-like messages).
How would I go about making a bot that also sends human time like messages?
Ad
Answer
You can use channel.startTyping()
and channel.stopTyping()
to simulate time being taken for a message to send https://discord.js.org/#/docs/main/stable/class/TextChannel?scrollTo=startTyping. Something like:
channel.startTyping();
setTimeout(()=>{
channel.send(string).then((message)=>{
channel.stopTyping();
});
}, 5000)
Ad
source: stackoverflow.com
Related Questions
- → Maximum call stack exceeded when instantiating class inside of a module
- → Browserify api: how to pass advanced option to script
- → Node.js Passing object from server.js to external modules?
- → gulp-rename makes copies, but does not replace
- → requiring RX.js in node.js
- → Remove an ObjectId from an array of objectId
- → Can not connect to Redis
- → React: How to publish page on server using React-starter-kit
- → Express - better pattern for passing data between middleware functions
- → Can't get plotly + node.js to stream data coming through POST requests
- → IsGenerator implementation
- → Async/Await not waiting
- → (Socket.io on nodejs) Updating div with mysql data stops without showing error
Ad