mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 18:43:31 +01:00
fix: channel type check in actions (#6086)
This commit is contained in:
@@ -15,7 +15,7 @@ class GuildDeleteAction extends Action {
|
|||||||
let guild = client.guilds.cache.get(data.id);
|
let guild = client.guilds.cache.get(data.id);
|
||||||
if (guild) {
|
if (guild) {
|
||||||
for (const channel of guild.channels.cache.values()) {
|
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) {
|
if (data.unavailable) {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class MessageReactionAdd extends Action {
|
|||||||
|
|
||||||
// Verify channel
|
// Verify channel
|
||||||
const channel = this.getChannel(data);
|
const channel = this.getChannel(data);
|
||||||
if (!channel || channel.type in VoiceBasedChannelTypes) return false;
|
if (!channel || VoiceBasedChannelTypes.includes(channel.type)) return false;
|
||||||
|
|
||||||
// Verify message
|
// Verify message
|
||||||
const message = this.getMessage(data, channel);
|
const message = this.getMessage(data, channel);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class MessageReactionRemove extends Action {
|
|||||||
|
|
||||||
// Verify channel
|
// Verify channel
|
||||||
const channel = this.getChannel(data);
|
const channel = this.getChannel(data);
|
||||||
if (!channel || channel.type in VoiceBasedChannelTypes) return false;
|
if (!channel || VoiceBasedChannelTypes.includes(channel.type)) return false;
|
||||||
|
|
||||||
// Verify message
|
// Verify message
|
||||||
const message = this.getMessage(data, channel);
|
const message = this.getMessage(data, channel);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class MessageReactionRemoveAll extends Action {
|
|||||||
handle(data) {
|
handle(data) {
|
||||||
// Verify channel
|
// Verify channel
|
||||||
const channel = this.getChannel(data);
|
const channel = this.getChannel(data);
|
||||||
if (!channel || channel.type in VoiceBasedChannelTypes) return false;
|
if (!channel || VoiceBasedChannelTypes.includes(channel.type)) return false;
|
||||||
|
|
||||||
// Verify message
|
// Verify message
|
||||||
const message = this.getMessage(data, channel);
|
const message = this.getMessage(data, channel);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const { Events, VoiceBasedChannelTypes } = require('../../util/Constants');
|
|||||||
class MessageReactionRemoveEmoji extends Action {
|
class MessageReactionRemoveEmoji extends Action {
|
||||||
handle(data) {
|
handle(data) {
|
||||||
const channel = this.getChannel(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);
|
const message = this.getMessage(data, channel);
|
||||||
if (!message) return false;
|
if (!message) return false;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class TypingStart extends Action {
|
|||||||
if (!channel) {
|
if (!channel) {
|
||||||
return;
|
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}`);
|
this.client.emit(Events.WARN, `Discord sent a typing packet to a ${channel.type} channel ${channel.id}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -573,7 +573,7 @@ class GuildChannel extends Channel {
|
|||||||
*/
|
*/
|
||||||
get manageable() {
|
get manageable() {
|
||||||
if (this.client.user.id === this.guild.ownerId) return true;
|
if (this.client.user.id === this.guild.ownerId) return true;
|
||||||
if (this.type in VoiceBasedChannelTypes) {
|
if (VoiceBasedChannelTypes.includes(this.type)) {
|
||||||
if (!this.permissionsFor(this.client.user).has(Permissions.FLAGS.CONNECT, false)) {
|
if (!this.permissionsFor(this.client.user).has(Permissions.FLAGS.CONNECT, false)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user