mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 03:23:29 +01:00
fix: typing start event emitting on non text based channels (#4349)
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user