fix: typing start event emitting on non text based channels (#4349)

This commit is contained in:
Souji
2020-06-19 11:42:06 +02:00
committed by GitHub
parent 54a7fdadda
commit 16847a3c13

View File

@@ -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;
}