mirror of
https://github.com/danbulant/discord.js
synced 2026-06-06 16:22:08 +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';
|
'use strict';
|
||||||
|
|
||||||
const { Events } = require('../../../util/Constants');
|
const { Events } = require('../../../util/Constants');
|
||||||
|
const textBasedChannelTypes = ['dm', 'text', 'news'];
|
||||||
|
|
||||||
module.exports = (client, { d: data }) => {
|
module.exports = (client, { d: data }) => {
|
||||||
const channel = client.channels.cache.get(data.channel_id);
|
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);
|
const timestamp = new Date(data.timestamp * 1000);
|
||||||
|
|
||||||
if (channel && user) {
|
if (channel && user) {
|
||||||
if (channel.type === 'voice') {
|
if (!textBasedChannelTypes.includes(channel.type)) {
|
||||||
client.emit(Events.WARN, `Discord sent a typing packet to a voice channel ${channel.id}`);
|
client.emit(Events.WARN, `Discord sent a typing packet to a ${channel.type} channel ${channel.id}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue