mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 11:33:30 +01:00
fix: GuildChannel#guildId not being patched to undefined (#10505)
* fix: `GuildChannel#guildId` not being patched to `undefined` * fix: guildId to guild_id check
This commit is contained in:
@@ -6,7 +6,11 @@ const Events = require('../../util/Events');
|
|||||||
class MessageCreateAction extends Action {
|
class MessageCreateAction extends Action {
|
||||||
handle(data) {
|
handle(data) {
|
||||||
const client = this.client;
|
const client = this.client;
|
||||||
const channel = this.getChannel({ id: data.channel_id, guild_id: data.guild_id, author: data.author });
|
const channel = this.getChannel({
|
||||||
|
id: data.channel_id,
|
||||||
|
author: data.author,
|
||||||
|
...('guild_id' in data && { guild_id: data.guild_id }),
|
||||||
|
});
|
||||||
if (channel) {
|
if (channel) {
|
||||||
if (!channel.isTextBased()) return {};
|
if (!channel.isTextBased()) return {};
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const Events = require('../../util/Events');
|
|||||||
class MessageDeleteAction extends Action {
|
class MessageDeleteAction extends Action {
|
||||||
handle(data) {
|
handle(data) {
|
||||||
const client = this.client;
|
const client = this.client;
|
||||||
const channel = this.getChannel({ id: data.channel_id, guild_id: data.guild_id });
|
const channel = this.getChannel({ id: data.channel_id, ...('guild_id' in data && { guild_id: data.guild_id }) });
|
||||||
let message;
|
let message;
|
||||||
if (channel) {
|
if (channel) {
|
||||||
if (!channel.isTextBased()) return {};
|
if (!channel.isTextBased()) return {};
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const Events = require('../../util/Events');
|
|||||||
|
|
||||||
class MessagePollVoteAddAction extends Action {
|
class MessagePollVoteAddAction extends Action {
|
||||||
handle(data) {
|
handle(data) {
|
||||||
const channel = this.getChannel({ id: data.channel_id, guild_id: data.guild_id });
|
const channel = this.getChannel({ id: data.channel_id, ...('guild_id' in data && { guild_id: data.guild_id }) });
|
||||||
if (!channel?.isTextBased()) return false;
|
if (!channel?.isTextBased()) return false;
|
||||||
|
|
||||||
const message = this.getMessage(data, channel);
|
const message = this.getMessage(data, channel);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const Events = require('../../util/Events');
|
|||||||
|
|
||||||
class MessagePollVoteRemoveAction extends Action {
|
class MessagePollVoteRemoveAction extends Action {
|
||||||
handle(data) {
|
handle(data) {
|
||||||
const channel = this.getChannel({ id: data.channel_id, guild_id: data.guild_id });
|
const channel = this.getChannel({ id: data.channel_id, ...('guild_id' in data && { guild_id: data.guild_id }) });
|
||||||
if (!channel?.isTextBased()) return false;
|
if (!channel?.isTextBased()) return false;
|
||||||
|
|
||||||
const message = this.getMessage(data, channel);
|
const message = this.getMessage(data, channel);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class MessageReactionAdd extends Action {
|
|||||||
// Verify channel
|
// Verify channel
|
||||||
const channel = this.getChannel({
|
const channel = this.getChannel({
|
||||||
id: data.channel_id,
|
id: data.channel_id,
|
||||||
guild_id: data.guild_id,
|
...('guild_id' in data && { guild_id: data.guild_id }),
|
||||||
user_id: data.user_id,
|
user_id: data.user_id,
|
||||||
...this.spreadInjectedData(data),
|
...this.spreadInjectedData(data),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -19,7 +19,11 @@ class MessageReactionRemove extends Action {
|
|||||||
if (!user) return false;
|
if (!user) return false;
|
||||||
|
|
||||||
// Verify channel
|
// Verify channel
|
||||||
const channel = this.getChannel({ id: data.channel_id, guild_id: data.guild_id, user_id: data.user_id });
|
const channel = this.getChannel({
|
||||||
|
id: data.channel_id,
|
||||||
|
...('guild_id' in data && { guild_id: data.guild_id }),
|
||||||
|
user_id: data.user_id,
|
||||||
|
});
|
||||||
if (!channel?.isTextBased()) return false;
|
if (!channel?.isTextBased()) return false;
|
||||||
|
|
||||||
// Verify message
|
// Verify message
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const Events = require('../../util/Events');
|
|||||||
class MessageReactionRemoveAll extends Action {
|
class MessageReactionRemoveAll extends Action {
|
||||||
handle(data) {
|
handle(data) {
|
||||||
// Verify channel
|
// Verify channel
|
||||||
const channel = this.getChannel({ id: data.channel_id, guild_id: data.guild_id });
|
const channel = this.getChannel({ id: data.channel_id, ...('guild_id' in data && { guild_id: data.guild_id }) });
|
||||||
if (!channel?.isTextBased()) return false;
|
if (!channel?.isTextBased()) return false;
|
||||||
|
|
||||||
// Verify message
|
// Verify message
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const Events = require('../../util/Events');
|
|||||||
|
|
||||||
class MessageReactionRemoveEmoji extends Action {
|
class MessageReactionRemoveEmoji extends Action {
|
||||||
handle(data) {
|
handle(data) {
|
||||||
const channel = this.getChannel({ id: data.channel_id, guild_id: data.guild_id });
|
const channel = this.getChannel({ id: data.channel_id, ...('guild_id' in data && { guild_id: data.guild_id }) });
|
||||||
if (!channel?.isTextBased()) return false;
|
if (!channel?.isTextBased()) return false;
|
||||||
|
|
||||||
const message = this.getMessage(data, channel);
|
const message = this.getMessage(data, channel);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const Action = require('./Action');
|
|||||||
|
|
||||||
class MessageUpdateAction extends Action {
|
class MessageUpdateAction extends Action {
|
||||||
handle(data) {
|
handle(data) {
|
||||||
const channel = this.getChannel({ id: data.channel_id, guild_id: data.guild_id });
|
const channel = this.getChannel({ id: data.channel_id, ...('guild_id' in data && { guild_id: data.guild_id }) });
|
||||||
if (channel) {
|
if (channel) {
|
||||||
if (!channel.isTextBased()) return {};
|
if (!channel.isTextBased()) return {};
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const Events = require('../../util/Events');
|
|||||||
|
|
||||||
class TypingStart extends Action {
|
class TypingStart extends Action {
|
||||||
handle(data) {
|
handle(data) {
|
||||||
const channel = this.getChannel({ id: data.channel_id, guild_id: data.guild_id });
|
const channel = this.getChannel({ id: data.channel_id, ...('guild_id' in data && { guild_id: data.guild_id }) });
|
||||||
if (!channel) return;
|
if (!channel) return;
|
||||||
|
|
||||||
if (!channel.isTextBased()) {
|
if (!channel.isTextBased()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user