@getsolara/solara.js
Version:
A lightweight and modular Discord bot framework built on discord.js v14, with truly optional feature packages.
18 lines • 750 B
JavaScript
module.exports = {
name: "$repliedMessageAuthor",
description: "Returns the User ID of the author of the message being replied to.",
takesBrackets: false,
execute: async (context, args) => {
if (!context.message || !context.message.reference || !context.message.reference.messageId) {
return "";
}
try {
const channel = context.channel;
if (!channel) return "[Error: Cannot determine channel context]";
const repliedMessage = await channel.messages.fetch(context.message.reference.messageId);
return repliedMessage.author.id;
} catch(e) {
return "[Error: Failed to fetch replied message]";
}
}
};