aboutsummaryrefslogtreecommitdiff
path: root/src/arguments/messageLink.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/arguments/messageLink.ts')
-rw-r--r--src/arguments/messageLink.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/arguments/messageLink.ts b/src/arguments/messageLink.ts
index a473485..c95e42d 100644
--- a/src/arguments/messageLink.ts
+++ b/src/arguments/messageLink.ts
@@ -1,7 +1,7 @@
import { BushArgumentTypeCaster, regex } from '#lib';
import type { Message } from 'discord.js';
-export const messageLink: BushArgumentTypeCaster<Promise<Message | null>> = async (_, phrase) => {
+export const messageLink: BushArgumentTypeCaster<Promise<Message | null>> = async (message, phrase) => {
const match = new RegExp(regex.messageLink).exec(phrase);
if (!match || !match.groups) return null;
@@ -9,12 +9,12 @@ export const messageLink: BushArgumentTypeCaster<Promise<Message | null>> = asyn
if (!guild_id || !channel_id || message_id) return null;
- const guild = client.guilds.cache.get(guild_id);
+ const guild = message.client.guilds.cache.get(guild_id);
if (!guild) return null;
const channel = guild.channels.cache.get(channel_id);
if (!channel || (!channel.isTextBased() && !channel.isThread())) return null;
- const message = await channel.messages.fetch(message_id).catch(() => null);
- return message;
+ const msg = await channel.messages.fetch(message_id).catch(() => null);
+ return msg;
};