having issues with the following code:
const cooldowns = new Map();
module.exports = {
name: 'slots',
description: 'slot machine',
async execute(message) {
const cooldownTime = 10 * 1000;
if (cooldowns.has(message.author.id)) {
const remainingTime = (cooldowns.get(message.author.id) - Date.now()) / 1000;
return message.channel.send(`Try again in ${remainingTime.toFixed(1)} seconds.`);
}
const slot1 = Math.floor(Math.random() * 10) + 1;
const slot2 = Math.floor(Math.random() * 10) + 1;
const slot3 = Math.floor(Math.random() * 10) + 1;
const isWin = (slot1 === slot2) && (slot2 === slot3);
const userID = message.author.id;
const winStatus = isWin ? 1 : 0;
if (winStatus === 1) {
message.channel.send(`# ${slot1} - ${slot2} - ${slot3} | YOU WIN, <@${userID}>!`);
} else {
return message.channel.send(`## ${slot1} - ${slot2} - ${slot3}`);
}
const { EmbedBuilder } = require('discord.js');
const channelID = '1238236155271446528';
const username = message.author.username;
const embed = new EmbedBuilder()
.setColor(0x0000ff)
.setTitle(`Timeout Ticket Won By <@${userID}>`)
.setTimestamp()
.setFooter({ text: username });
const channel = message.guild.channels.cache.get(channelID);
channel.send({ embeds: [embed] });
cooldowns.set(message.author.id, Date.now() + cooldownTime);
setTimeout(() => cooldowns.delete(message.author.id), cooldownTime);
},
};