Adding 8-ball command

This commit is contained in:
Raven Scott 2022-10-17 00:38:56 -04:00
parent f15c2786a6
commit 8561265a05
6 changed files with 258 additions and 5 deletions

View File

@ -1,10 +1,19 @@
const { EmbedBuilder } = require('discord.js'); const { EmbedBuilder } = require('discord.js');
const { ContextMenuCommandBuilder, ApplicationCommandType } = require('discord.js');
module.exports = { module.exports = {
name: "ping", name: "ping",
description: "Returns websocket latency", description: "Returns websocket latency",
run: async (client, interaction) => { run: async (client, interaction) => {
const { ContextMenuCommandBuilder, ApplicationCommandType } = require('discord.js');
const data = new ContextMenuCommandBuilder()
.setName('User Information')
.setType(ApplicationCommandType.User);
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setColor("#FF0000") .setColor("#FF0000")
.setTitle("🏓 Pong!") .setTitle("🏓 Pong!")

52
commands/untils/8ball.js Normal file
View 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");
}
},
};

View File

@ -5,7 +5,7 @@ const {
AttachmentBuilder AttachmentBuilder
} = require('discord.js'); } = require('discord.js');
var download = require('download-file') var download = require('download-file')
const isNotDefined = require("is-not-defined"); const notDefined = require("is-not-defined");
let phonetic let phonetic
var unirest = require('unirest'); var unirest = require('unirest');
let meaningsArray = [] let meaningsArray = []
@ -31,11 +31,11 @@ module.exports = {
}) })
.then((response) => { .then((response) => {
let data = response.body[0] let data = response.body[0]
if (isNotDefined(data)) { if (notDefined(data)) {
return interaction.editReply("Sorry, nothing was found!") return interaction.editReply("Sorry, nothing was found!")
} }
if (isNotDefined(data.phonetics[1])) { if (notDefined(data.phonetics[1])) {
phonetic = "" phonetic = ""
} else { } else {
phonetic = data.phonetics[1].text phonetic = data.phonetics[1].text

View File

@ -37,8 +37,6 @@ client.on("interactionCreate", async (interaction) => {
let dataToProcess = JSON.stringify(commandData[0]) let dataToProcess = JSON.stringify(commandData[0])
let parsedData = JSON.parse(dataToProcess) let parsedData = JSON.parse(dataToProcess)
console.log(parsedData.private)
if (parsedData.private == true) { if (parsedData.private == true) {
await interaction.deferReply({ ephemeral: true }).catch(() => { }); await interaction.deferReply({ ephemeral: true }).catch(() => { });

189
package-lock.json generated
View File

@ -13,9 +13,13 @@
"discord.js": "^14.0.3", "discord.js": "^14.0.3",
"dotenv": "^16.0.0", "dotenv": "^16.0.0",
"download-file": "^0.1.5", "download-file": "^0.1.5",
"duckduckgo-search-api": "^1.0.5",
"freesound-client": "^0.4.4",
"general-search-engine": "^1.4.1",
"generate-password": "^1.7.0", "generate-password": "^1.7.0",
"give-me-a-joke": "^0.5.1", "give-me-a-joke": "^0.5.1",
"glob": "^7.2.0", "glob": "^7.2.0",
"googleimg": "^3.0.1",
"is-not-defined": "^1.0.1", "is-not-defined": "^1.0.1",
"random-text-meme": "^1.1.9", "random-text-meme": "^1.1.9",
"unirest": "^0.6.0", "unirest": "^0.6.0",
@ -122,6 +126,28 @@
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.19.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.19.tgz",
"integrity": "sha512-Sq1itGUKUX1ap7GgZlrzdBydjbsJL/NSQt/4wkAxUJ7/OS5c2WkoN6WSpWc2Yc5wtKMZOUA0VCs/j2XJadN3HA==" "integrity": "sha512-Sq1itGUKUX1ap7GgZlrzdBydjbsJL/NSQt/4wkAxUJ7/OS5c2WkoN6WSpWc2Yc5wtKMZOUA0VCs/j2XJadN3HA=="
}, },
"node_modules/@types/node-fetch": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.2.tgz",
"integrity": "sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==",
"dependencies": {
"@types/node": "*",
"form-data": "^3.0.0"
}
},
"node_modules/@types/node-fetch/node_modules/form-data": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz",
"integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/@types/ws": { "node_modules/@types/ws": {
"version": "8.5.3", "version": "8.5.3",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz",
@ -461,6 +487,11 @@
"node": ">=16.9.0" "node": ">=16.9.0"
} }
}, },
"node_modules/dom-parser": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/dom-parser/-/dom-parser-0.1.6.tgz",
"integrity": "sha512-3nVRKbLEwmGfghLoeT1dxlK/0votalnOfasP+8VCHYDfDuCETY4LeMblfOeqww6XZk2ymZ1Uewy/hVad6Dy3yw=="
},
"node_modules/dotenv": { "node_modules/dotenv": {
"version": "16.0.2", "version": "16.0.2",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.2.tgz", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.2.tgz",
@ -488,6 +519,11 @@
"mkdirp": "bin/cmd.js" "mkdirp": "bin/cmd.js"
} }
}, },
"node_modules/duckduckgo-search-api": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/duckduckgo-search-api/-/duckduckgo-search-api-1.0.5.tgz",
"integrity": "sha512-OIm6gXulf+n+go5p+oDIu9bhO/VBJcf1SzmNr+mVF6oYwlNeNhvLQY2JT7NdiU6Ja31ZjkJuTlepMMmpis/eAg=="
},
"node_modules/ecc-jsbn": { "node_modules/ecc-jsbn": {
"version": "0.1.2", "version": "0.1.2",
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
@ -581,6 +617,29 @@
"node": ">= 0.12" "node": ">= 0.12"
} }
}, },
"node_modules/freesound-client": {
"version": "0.4.4",
"resolved": "https://registry.npmjs.org/freesound-client/-/freesound-client-0.4.4.tgz",
"integrity": "sha512-xbyyfKPpuhvgRdirK2lWS/rXVupKIVEQ6ADX6hu8rsl6LN9lUgn/mCKuUtlJ2SLpWxFoH+ti02mBn7VzQeYYwQ==",
"dependencies": {
"@types/node-fetch": "^2.6.2",
"form-data": "^4.0.0",
"node-fetch": "^2.6.7"
}
},
"node_modules/freesound-client/node_modules/form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/fs-minipass": { "node_modules/fs-minipass": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",
@ -616,6 +675,15 @@
"node": ">=10" "node": ">=10"
} }
}, },
"node_modules/general-search-engine": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/general-search-engine/-/general-search-engine-1.4.1.tgz",
"integrity": "sha512-Il0sHO6pZMtWbMdJOMChj5WJamc251PBa6soW+WoenIlRFQwc9Rq2pYUyplgmozwaDWuWLlU6ko+RdwqatZixg==",
"dependencies": {
"dom-parser": "^0.1.6",
"node-fetch": "^2.6.1"
}
},
"node_modules/generate-password": { "node_modules/generate-password": {
"version": "1.7.0", "version": "1.7.0",
"resolved": "https://registry.npmjs.org/generate-password/-/generate-password-1.7.0.tgz", "resolved": "https://registry.npmjs.org/generate-password/-/generate-password-1.7.0.tgz",
@ -657,6 +725,36 @@
"url": "https://github.com/sponsors/isaacs" "url": "https://github.com/sponsors/isaacs"
} }
}, },
"node_modules/googleimg": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/googleimg/-/googleimg-3.0.1.tgz",
"integrity": "sha512-Gp0vxzjOfuHrgomoHdrHmJAqzatL7H5FobhAjJQXc9QeELh8AdHot9ChURsdcQIiO6m9EQAhTxVeoKceJg9Aeg==",
"dependencies": {
"axios": "^0.27.2"
}
},
"node_modules/googleimg/node_modules/axios": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
"integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
"dependencies": {
"follow-redirects": "^1.14.9",
"form-data": "^4.0.0"
}
},
"node_modules/googleimg/node_modules/form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/har-schema": { "node_modules/har-schema": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
@ -1612,6 +1710,27 @@
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.19.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.19.tgz",
"integrity": "sha512-Sq1itGUKUX1ap7GgZlrzdBydjbsJL/NSQt/4wkAxUJ7/OS5c2WkoN6WSpWc2Yc5wtKMZOUA0VCs/j2XJadN3HA==" "integrity": "sha512-Sq1itGUKUX1ap7GgZlrzdBydjbsJL/NSQt/4wkAxUJ7/OS5c2WkoN6WSpWc2Yc5wtKMZOUA0VCs/j2XJadN3HA=="
}, },
"@types/node-fetch": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.2.tgz",
"integrity": "sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==",
"requires": {
"@types/node": "*",
"form-data": "^3.0.0"
},
"dependencies": {
"form-data": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz",
"integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
}
}
}
},
"@types/ws": { "@types/ws": {
"version": "8.5.3", "version": "8.5.3",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz",
@ -1865,6 +1984,11 @@
"ws": "^8.8.1" "ws": "^8.8.1"
} }
}, },
"dom-parser": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/dom-parser/-/dom-parser-0.1.6.tgz",
"integrity": "sha512-3nVRKbLEwmGfghLoeT1dxlK/0votalnOfasP+8VCHYDfDuCETY4LeMblfOeqww6XZk2ymZ1Uewy/hVad6Dy3yw=="
},
"dotenv": { "dotenv": {
"version": "16.0.2", "version": "16.0.2",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.2.tgz", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.2.tgz",
@ -1888,6 +2012,11 @@
} }
} }
}, },
"duckduckgo-search-api": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/duckduckgo-search-api/-/duckduckgo-search-api-1.0.5.tgz",
"integrity": "sha512-OIm6gXulf+n+go5p+oDIu9bhO/VBJcf1SzmNr+mVF6oYwlNeNhvLQY2JT7NdiU6Ja31ZjkJuTlepMMmpis/eAg=="
},
"ecc-jsbn": { "ecc-jsbn": {
"version": "0.1.2", "version": "0.1.2",
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
@ -1952,6 +2081,28 @@
"mime-types": "^2.1.12" "mime-types": "^2.1.12"
} }
}, },
"freesound-client": {
"version": "0.4.4",
"resolved": "https://registry.npmjs.org/freesound-client/-/freesound-client-0.4.4.tgz",
"integrity": "sha512-xbyyfKPpuhvgRdirK2lWS/rXVupKIVEQ6ADX6hu8rsl6LN9lUgn/mCKuUtlJ2SLpWxFoH+ti02mBn7VzQeYYwQ==",
"requires": {
"@types/node-fetch": "^2.6.2",
"form-data": "^4.0.0",
"node-fetch": "^2.6.7"
},
"dependencies": {
"form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
}
}
}
},
"fs-minipass": { "fs-minipass": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",
@ -1981,6 +2132,15 @@
"wide-align": "^1.1.2" "wide-align": "^1.1.2"
} }
}, },
"general-search-engine": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/general-search-engine/-/general-search-engine-1.4.1.tgz",
"integrity": "sha512-Il0sHO6pZMtWbMdJOMChj5WJamc251PBa6soW+WoenIlRFQwc9Rq2pYUyplgmozwaDWuWLlU6ko+RdwqatZixg==",
"requires": {
"dom-parser": "^0.1.6",
"node-fetch": "^2.6.1"
}
},
"generate-password": { "generate-password": {
"version": "1.7.0", "version": "1.7.0",
"resolved": "https://registry.npmjs.org/generate-password/-/generate-password-1.7.0.tgz", "resolved": "https://registry.npmjs.org/generate-password/-/generate-password-1.7.0.tgz",
@ -2016,6 +2176,35 @@
"path-is-absolute": "^1.0.0" "path-is-absolute": "^1.0.0"
} }
}, },
"googleimg": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/googleimg/-/googleimg-3.0.1.tgz",
"integrity": "sha512-Gp0vxzjOfuHrgomoHdrHmJAqzatL7H5FobhAjJQXc9QeELh8AdHot9ChURsdcQIiO6m9EQAhTxVeoKceJg9Aeg==",
"requires": {
"axios": "^0.27.2"
},
"dependencies": {
"axios": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
"integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
"requires": {
"follow-redirects": "^1.14.9",
"form-data": "^4.0.0"
}
},
"form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
}
}
}
},
"har-schema": { "har-schema": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",

View File

@ -3,6 +3,7 @@
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"type": "commonjs",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
@ -14,9 +15,13 @@
"discord.js": "^14.0.3", "discord.js": "^14.0.3",
"dotenv": "^16.0.0", "dotenv": "^16.0.0",
"download-file": "^0.1.5", "download-file": "^0.1.5",
"duckduckgo-search-api": "^1.0.5",
"freesound-client": "^0.4.4",
"general-search-engine": "^1.4.1",
"generate-password": "^1.7.0", "generate-password": "^1.7.0",
"give-me-a-joke": "^0.5.1", "give-me-a-joke": "^0.5.1",
"glob": "^7.2.0", "glob": "^7.2.0",
"googleimg": "^3.0.1",
"is-not-defined": "^1.0.1", "is-not-defined": "^1.0.1",
"random-text-meme": "^1.1.9", "random-text-meme": "^1.1.9",
"unirest": "^0.6.0", "unirest": "^0.6.0",