Add drop and pull cooldowns

This commit is contained in:
2022-08-19 14:41:48 +02:00
parent 51e90dee8a
commit e21fc57f22
8 changed files with 177 additions and 18 deletions

31
commands/cooldowns.js Normal file
View File

@@ -0,0 +1,31 @@
const { SlashCommandBuilder } = require("discord.js");
const { Card, User, Character } = require("../models");
const { UserUtils } = require("../util");
//fetch all cards owned by the user and list them
module.exports = {
data: new SlashCommandBuilder()
.setName("cooldowns")
.setDescription("List cooldowns"),
async execute(interaction) {
//fetch the user given the userID and include his cards
const user = await UserUtils.getUserByDiscordId(interaction.member.id);
//get user cooldowns using user utils
const cooldowns = await UserUtils.getCooldowns(user);
let reply = "Cooldowns:\n";
for (cooldown in cooldowns) {
//if cooldown contains the string formatted
if (cooldown.includes("Formatted")) {
reply += `${cooldowns[cooldown]}\n`;
}
}
interaction.reply({
content: reply,
ephemeral: false
});
}
}