Adding 8-ball command
This commit is contained in:
@ -1,10 +1,19 @@
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const { ContextMenuCommandBuilder, ApplicationCommandType } = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
name: "ping",
|
||||
description: "Returns websocket latency",
|
||||
|
||||
run: async (client, interaction) => {
|
||||
|
||||
|
||||
const { ContextMenuCommandBuilder, ApplicationCommandType } = require('discord.js');
|
||||
|
||||
const data = new ContextMenuCommandBuilder()
|
||||
.setName('User Information')
|
||||
.setType(ApplicationCommandType.User);
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor("#FF0000")
|
||||
.setTitle("🏓 Pong!")
|
||||
|
52
commands/untils/8ball.js
Normal file
52
commands/untils/8ball.js
Normal file
@ -0,0 +1,52 @@
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
|
||||
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
|
||||
}],
|
||||
run: async (client, interaction) => {
|
||||
let question = interaction.options._hoistedOptions[0].value
|
||||
|
||||
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");
|
||||
}
|
||||
},
|
||||
};
|
@ -5,7 +5,7 @@ const {
|
||||
AttachmentBuilder
|
||||
} = require('discord.js');
|
||||
var download = require('download-file')
|
||||
const isNotDefined = require("is-not-defined");
|
||||
const notDefined = require("is-not-defined");
|
||||
let phonetic
|
||||
var unirest = require('unirest');
|
||||
let meaningsArray = []
|
||||
@ -31,11 +31,11 @@ module.exports = {
|
||||
})
|
||||
.then((response) => {
|
||||
let data = response.body[0]
|
||||
if (isNotDefined(data)) {
|
||||
if (notDefined(data)) {
|
||||
return interaction.editReply("Sorry, nothing was found!")
|
||||
}
|
||||
|
||||
if (isNotDefined(data.phonetics[1])) {
|
||||
if (notDefined(data.phonetics[1])) {
|
||||
phonetic = ""
|
||||
} else {
|
||||
phonetic = data.phonetics[1].text
|
||||
|
Reference in New Issue
Block a user