Profiles: Add user profile model and command

This commit is contained in:
2022-09-05 23:22:36 +02:00
parent bba51cea2e
commit 1206251ff6
4 changed files with 134 additions and 0 deletions

18
commands/profile.js Normal file
View File

@@ -0,0 +1,18 @@
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js");
const { Card, User, Character } = require("../models");
const UserUtils = require("../util/users");
const pageSize = 8;
//fetch all cards owned by the user and list them
module.exports = {
data: new SlashCommandBuilder()
.setName("profile")
.setDescription("View your profile"),
async execute(interaction) {
let user = await UserUtils.getUserByDiscordId(interaction.member.id);
let profile = await user.getProfile();
await interaction.reply(`json: ${JSON.stringify(profile)}`);
}
}