Skip to content

Commit

Permalink
[New] Added prefix support for 8ball and jokes commands
Browse files Browse the repository at this point in the history
  • Loading branch information
naseif committed Oct 4, 2021
1 parent 7e74504 commit 25d5942
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
38 changes: 38 additions & 0 deletions commands/Fun/8ball.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,44 @@
const { SlashCommandBuilder } = require("@discordjs/builders");
const { embedMessage } = require("../../modules/embedSimple");

module.exports = {
name: "8ball",
args: true,
usage: "8ball <question>",
description: "Ask the magic ball a question!",
async run(message) {
const question = args.join(" ");

if (!question)
return await message.channel.send({
embeds: [embedMessage("9dcc37", `You did not ask me anything!`)],
});

const answers = [
"Aboslutely 👌",
"I am not sure, but maybe? 🤐",
"Yes! 💯",
"No! 😡",
"Uhh, yeah sure 😕",
"Mhmm, why not 🤷‍♂️",
"Hell no! 🤫",
"I won't answer that 🤥",
"That's a bit lewd 🤤",
];

const embed = {
color: "#9dcc37",
title: `${question}`,
author: {
name: `${message.member.user.username}`,
icon_url: `${message.member.user.avatarURL()}`,
},
description: `${answers[Math.floor(Math.random() * answers.length)]}`,
};
await message.channel.send({
embeds: [embed],
});
},
data: new SlashCommandBuilder()
.setName("8ball")
.setDescription("ask the magic ball a question!")
Expand Down
44 changes: 44 additions & 0 deletions commands/Fun/jokes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,50 @@ const { SlashCommandBuilder } = require("@discordjs/builders");
const { requestAPI } = require("../../modules/requestAPI");

module.exports = {
name: "joke",
args: false,
usage: "joke <question>",
description: "Gets a random joke!",
async run(message, args, client) {
try {
const joke = await requestAPI(
"https://v2.jokeapi.dev/joke/Miscellaneous,Dark,Pun,Spooky,Christmas"
);

const embed = {
color: "#9dcc37",
title: `Collection of Jokes`,
description: `Dark Jokes ftw`,
fields: [
{
name: "Joke",
value: `${
joke.type === "twopart"
? `${joke.setup}\n${joke.delivery}`
: `${joke.joke}`
}`,
},
{
name: "Category",
value: `${joke.category}`,
inline: true,
},
{
name: "Type",
value: `${joke.type}`,
inline: true,
},
],
};

await message.channel.send({ embeds: [embed] });
} catch (err) {
client.logger(err.message, "error");
await message.channel.send(
`Could not retrieve a Joke, I blame <@503264757785165851>`
);
}
},
data: new SlashCommandBuilder()
.setName("joke")
.setDescription("gets a random joke!"),
Expand Down

0 comments on commit 25d5942

Please sign in to comment.