Reputation: 5
is there a possibility I can detect If a user starts/stops typing? I use the Discord.js Webpack Version 12 and I can't seem to find any solution to this?
Upvotes: 0
Views: 3924
Reputation: 8402
You can use the typingStart()
event, which will trigger when a user starts typing.
client.on('typingStart', (channel, user) => {
console.log(`${user.username} is typing in ${channel.name}`)
};
There is also the User.typingIn()
method, which will check if a user is typing in a specified channel, and return a boolean
.
if (<user>.typingIn(<channel>))
console.log(`${<user>.username} in typing in ${<channel>.name}`);
(You can also use the typingDurationIn()
and typingSinceIn()
methods)
Lastly, you can look at the TextChannel.typing
property of a TextChannel
to detect if anyone is typing in that channel.
if (<channel>.typing)
console.log(`Somebody is typing in ${channel.name}`);
(You can also use the typingCount
property to see how many people are typing in the given channel)
Upvotes: 1