src/interactions/menus/getInfo.ts (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
import {
ApplicationCommandType,
type Client,
ContextMenuCommandBuilder,
type UserContextMenuCommandInteraction,
} from "discord.js";
import config from "@/config";
import { getUserInfoFromDiscord } from "@/utils/userInfo";
const commandData = new ContextMenuCommandBuilder()
.setName("get account")
.setType(ApplicationCommandType.User);
async function execute(
_client: Client,
interaction: UserContextMenuCommandInteraction,
) {
if (!interaction.member) {
await interaction.reply({
content: "❌ you must be in a server to use this command.",
flags: ["Ephemeral"],
});
return;
}
const result = await getUserInfoFromDiscord(
interaction.targetId,
interaction.member,
);
if ("error" in result) {
return interaction.reply({
content: `❌ ${result.error}`,
flags: ["Ephemeral"],
});
}
await interaction.reply({
flags: ["IsComponentsV2"],
components: [...result.containers, ...result.actionRows],
});
await interaction.followUp({ content: result.user.id });
}
export default {
enabled: config.data.bloxlink?.token && config.data.roblox?.apiKey,
data: commandData,
execute,
};
|