fix: channel type check in actions (#6086)

This commit is contained in:
Rodry
2021-07-10 21:51:32 +01:00
committed by GitHub
parent f72ce7c136
commit d433fe8a08
7 changed files with 7 additions and 7 deletions

View File

@@ -15,7 +15,7 @@ class GuildDeleteAction extends Action {
let guild = client.guilds.cache.get(data.id);
if (guild) {
for (const channel of guild.channels.cache.values()) {
if (channel.type in TextBasedChannelTypes) channel.stopTyping(true);
if (TextBasedChannelTypes.includes(channel.type)) channel.stopTyping(true);
}
if (data.unavailable) {

View File

@@ -23,7 +23,7 @@ class MessageReactionAdd extends Action {
// Verify channel
const channel = this.getChannel(data);
if (!channel || channel.type in VoiceBasedChannelTypes) return false;
if (!channel || VoiceBasedChannelTypes.includes(channel.type)) return false;
// Verify message
const message = this.getMessage(data, channel);

View File

@@ -20,7 +20,7 @@ class MessageReactionRemove extends Action {
// Verify channel
const channel = this.getChannel(data);
if (!channel || channel.type in VoiceBasedChannelTypes) return false;
if (!channel || VoiceBasedChannelTypes.includes(channel.type)) return false;
// Verify message
const message = this.getMessage(data, channel);

View File

@@ -7,7 +7,7 @@ class MessageReactionRemoveAll extends Action {
handle(data) {
// Verify channel
const channel = this.getChannel(data);
if (!channel || channel.type in VoiceBasedChannelTypes) return false;
if (!channel || VoiceBasedChannelTypes.includes(channel.type)) return false;
// Verify message
const message = this.getMessage(data, channel);

View File

@@ -6,7 +6,7 @@ const { Events, VoiceBasedChannelTypes } = require('../../util/Constants');
class MessageReactionRemoveEmoji extends Action {
handle(data) {
const channel = this.getChannel(data);
if (!channel || channel.type in VoiceBasedChannelTypes) return false;
if (!channel || VoiceBasedChannelTypes.includes(channel.type)) return false;
const message = this.getMessage(data, channel);
if (!message) return false;

View File

@@ -9,7 +9,7 @@ class TypingStart extends Action {
if (!channel) {
return;
}
if (!(channel.type in TextBasedChannelTypes)) {
if (!TextBasedChannelTypes.includes(channel.type)) {
this.client.emit(Events.WARN, `Discord sent a typing packet to a ${channel.type} channel ${channel.id}`);
return;
}