mirror of
https://github.com/danbulant/discord.js
synced 2026-05-27 22:11:53 +00:00
fix: typing start event emitting on non text based channels (#4349)
This commit is contained in:
parent
54a7fdadda
commit
16847a3c13
1 changed files with 3 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
const { Events } = require('../../../util/Constants');
|
||||
const textBasedChannelTypes = ['dm', 'text', 'news'];
|
||||
|
||||
module.exports = (client, { d: data }) => {
|
||||
const channel = client.channels.cache.get(data.channel_id);
|
||||
|
|
@ -8,8 +9,8 @@ module.exports = (client, { d: data }) => {
|
|||
const timestamp = new Date(data.timestamp * 1000);
|
||||
|
||||
if (channel && user) {
|
||||
if (channel.type === 'voice') {
|
||||
client.emit(Events.WARN, `Discord sent a typing packet to a voice channel ${channel.id}`);
|
||||
if (!textBasedChannelTypes.includes(channel.type)) {
|
||||
client.emit(Events.WARN, `Discord sent a typing packet to a ${channel.type} channel ${channel.id}`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue