check for a referenced message one time (#137)
All checks were successful
Lint and Format Check / lint-and-format (pull_request) Successful in 10s
All checks were successful
Lint and Format Check / lint-and-format (pull_request) Successful in 10s
This commit is contained in:
parent
e4cdd11c1a
commit
99dd235a39
1 changed files with 13 additions and 1 deletions
|
@ -65,7 +65,19 @@ export default async (message: Message, client: Client) => {
|
||||||
[],
|
[],
|
||||||
)
|
)
|
||||||
.map(async ({ message_id, channel }) => {
|
.map(async ({ message_id, channel }) => {
|
||||||
const quoted_message = await channel.messages.fetch(message_id).catch(() => undefined);
|
let quoted_message = await channel.messages.fetch(message_id).catch(() => undefined);
|
||||||
|
|
||||||
|
// If it's a reference, we only check for reference once
|
||||||
|
const message_reference = quoted_message?.reference;
|
||||||
|
if (message_reference && message_reference.messageId) {
|
||||||
|
const channel_reference = client.channels.cache.get(
|
||||||
|
message_reference.channelId,
|
||||||
|
) as TextBasedChannel;
|
||||||
|
|
||||||
|
quoted_message = await channel_reference.messages
|
||||||
|
.fetch(message_reference.messageId)
|
||||||
|
.catch(() => undefined);
|
||||||
|
}
|
||||||
|
|
||||||
// If message doesn't exist or empty
|
// If message doesn't exist or empty
|
||||||
if (
|
if (
|
||||||
|
|
Loading…
Reference in a new issue