mirror of
https://github.com/danbulant/discord.js
synced 2026-06-10 02:02:40 +00:00
fix(Webhook): return raw data if the channel is unavailable
Fixes #3424
This commit is contained in:
parent
1851f74770
commit
c786867bd6
1 changed files with 7 additions and 5 deletions
|
|
@ -146,8 +146,9 @@ class Webhook {
|
||||||
query: { wait: true },
|
query: { wait: true },
|
||||||
auth: false,
|
auth: false,
|
||||||
}).then(d => {
|
}).then(d => {
|
||||||
if (!this.client.channels) return d;
|
const channel = this.client.channels ? this.client.channels.get(d.channel_id) : undefined;
|
||||||
return this.client.channels.get(d.channel_id).messages.add(d, false);
|
if (!channel) return d;
|
||||||
|
return channel.messages.add(d, false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -173,9 +174,10 @@ class Webhook {
|
||||||
query: { wait: true },
|
query: { wait: true },
|
||||||
auth: false,
|
auth: false,
|
||||||
data: body,
|
data: body,
|
||||||
}).then(data => {
|
}).then(d => {
|
||||||
if (!this.client.channels) return data;
|
const channel = this.client.channels ? this.client.channels.get(d.channel_id) : undefined;
|
||||||
return this.client.channels.get(data.channel_id).messages.add(data, false);
|
if (!channel) return d;
|
||||||
|
return channel.messages.add(d, false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue