Files
ShaiBot/commands/applications/profile.js
T
2026-08-23 00:09:13 +02:00

47 lines
1.2 KiB
JavaScript

const { SlashCommandBuilder } = require("discord.js");
const {
buildProfileOverview,
buildProfileButtons
} = require("../../utils/profileSystem");
const {
createInteractionSession
} = require("../../utils/interactionSession");
module.exports = {
data: new SlashCommandBuilder()
.setName("profile")
.setDescription("View a player profile")
.addUserOption(option =>
option
.setName("user")
.setDescription("Player to view")
),
async execute(interaction) {
const user = interaction.options.getUser("user") ?? interaction.user;
const embed = await buildProfileOverview(
interaction.guildId,
user,
interaction.user.id
);
await interaction.reply({
embeds: [embed],
components: buildProfileButtons()
});
const message = await interaction.fetchReply();
await createInteractionSession(
interaction,
{
messageId: message.id,
ownerId: interaction.user.id,
kind: "profile",
targetId: user.id
}
);
}
};