rolling back to refine later

This commit is contained in:
Raven Scott
2023-01-08 10:01:54 +02:00
parent 85f2d8d04a
commit 65adff92d0
7 changed files with 215 additions and 194 deletions

View File

@ -4,40 +4,49 @@ module.exports = {
name: "8ball",
description: "Ask a question, get a response.",
options: [{
name: "question",
description: "The question you would like to ask.",
required: true,
type: 3 // 6 is type USER
}],
"name": "question",
"description": "The question you would like to ask.",
"required": true,
"type": 3 // 6 is type USER
}],
run: async (client, interaction) => {
let question = interaction.options._hoistedOptions[0].value;
let question = interaction.options._hoistedOptions[0].value
const responses = [
"It is certain",
"It is decidedly so",
"Reply hazy try again",
"Cannot predict now",
"Do not count on it",
"My sources say no",
"Outlook not so good",
"Signs point to yes"
];
const response = responses[Math.floor(Math.random() * responses.length)];
const embed = create8BallEmbed(question, response, interaction.user);
function send(question, message){
const embed = new EmbedBuilder()
.setColor("#FF0000")
.setTitle(question)
.setDescription(message)
.setTimestamp()
.setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL()}` });
interaction.editReply({ embeds: [embed] });
}
var answer = Math.floor(Math.random() * 8);
if (answer === 0) {
send(question, "it is certain")
}
else if (answer === 1) {
send(question, "It is decidedly so");
}
else if (answer === 2) {
send(question, "Reply hazy try again");
}
else if (answer === 3) {
send(question, "Cannot predict now");
}
else if (answer === 4) {
send(question, "Do not count on it");
}
else if (answer === 5) {
send(question, "My sources say no");
}
else if (answer === 6) {
send(question, "Outlook not so good");
}
else if (answer === 7) {
send(question, "Signs point to yes");
}
},
};
function create8BallEmbed(question, response, user) {
return new EmbedBuilder()
.setColor("#FF0000")
.setTitle(question)
.setDescription(response)
.setTimestamp()
.setFooter({
text: `Requested by ${user.tag}`,
iconURL: user.displayAvatarURL()
});
}