rolling back to refine later
This commit is contained in:
@ -1,31 +1,43 @@
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const giveMeAJoke = require('give-me-a-joke');
|
||||
const {
|
||||
EmbedBuilder
|
||||
} = require('discord.js');
|
||||
var giveMeAJoke = require('give-me-a-joke');
|
||||
|
||||
module.exports = {
|
||||
name: "joke",
|
||||
description: "Gets a funny joke",
|
||||
|
||||
async run(client, interaction) {
|
||||
let joke = await giveMeAJoke.getRandomDadJoke();
|
||||
run: async (client, interaction) => {
|
||||
giveMeAJoke.getRandomDadJoke(function (joke) {
|
||||
|
||||
if (joke.includes("?")){
|
||||
let jokeData = joke.split("?");
|
||||
joke = `${jokeData[0]}?||${jokeData[1]}||`;
|
||||
}
|
||||
|
||||
const embed = createJokeEmbed(joke, interaction.user);
|
||||
interaction.editReply({ embeds: [embed] });
|
||||
if (joke.includes("?")){
|
||||
let jokeData = joke.split("?")
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor("#FF0000")
|
||||
.setTitle("Here is your joke...")
|
||||
.setDescription(jokeData[0] + "?||" + jokeData[1] + "||")
|
||||
.setTimestamp()
|
||||
.setFooter({
|
||||
text: `Requested by ${interaction.user.tag}`,
|
||||
iconURL: `${interaction.user.displayAvatarURL()}`
|
||||
});
|
||||
interaction.editReply({
|
||||
embeds: [embed]
|
||||
});
|
||||
} else {
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor("#FF0000")
|
||||
.setTitle("Here is your joke...")
|
||||
.setDescription(joke)
|
||||
.setTimestamp()
|
||||
.setFooter({
|
||||
text: `Requested by ${interaction.user.tag}`,
|
||||
iconURL: `${interaction.user.displayAvatarURL()}`
|
||||
});
|
||||
interaction.editReply({
|
||||
embeds: [embed]
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
};
|
||||
|
||||
function createJokeEmbed(joke, user) {
|
||||
return new EmbedBuilder()
|
||||
.setColor("#FF0000")
|
||||
.setTitle("Here is your joke...")
|
||||
.setDescription(joke)
|
||||
.setTimestamp()
|
||||
.setFooter({
|
||||
text: `Requested by ${user.tag}`,
|
||||
iconURL: user.displayAvatarURL()
|
||||
});
|
||||
}
|
||||
};
|
@ -1,40 +1,47 @@
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const urban = require('urban');
|
||||
const {
|
||||
EmbedBuilder
|
||||
} = require('discord.js');
|
||||
var urban = require('urban')
|
||||
const isNotDefined = require("is-not-defined");
|
||||
|
||||
module.exports = {
|
||||
name: "urban",
|
||||
description: "Searches Urban Dictionary",
|
||||
options: [{
|
||||
name: "query",
|
||||
description: "The thing you want to search for",
|
||||
required: true,
|
||||
type: 3 // 6 is type USER
|
||||
"name": "query",
|
||||
"description": "The thing you want to search for",
|
||||
"required": true,
|
||||
"type": 3 // 6 is type USER
|
||||
}],
|
||||
|
||||
async run(client, interaction) {
|
||||
let searchWord = interaction.options._hoistedOptions[0].value;
|
||||
let search = urban(searchWord);
|
||||
run: async (client, interaction) => {
|
||||
|
||||
let data = await search.first();
|
||||
let searchWord = interaction.options._hoistedOptions[0].value
|
||||
search = urban(searchWord);
|
||||
|
||||
if (data) {
|
||||
const embed = createUrbanEmbed(data, searchWord, interaction.user);
|
||||
interaction.editReply({ embeds: [embed] });
|
||||
} else {
|
||||
interaction.editReply("Sorry, no results were found!");
|
||||
}
|
||||
},
|
||||
};
|
||||
search.first(function(data) {
|
||||
|
||||
function createUrbanEmbed(data, searchWord, user) {
|
||||
return new EmbedBuilder()
|
||||
.setColor("#FF0000")
|
||||
.setTitle(`Results for: ${searchWord}`)
|
||||
.setDescription(`Definition: ${data.definition}`)
|
||||
.addFields({ name: 'Example', value: data.example })
|
||||
.setTimestamp()
|
||||
.setFooter({
|
||||
text: `Requested by ${user.tag}`,
|
||||
iconURL: user.displayAvatarURL()
|
||||
if (!isNotDefined(data)) {
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor("#FF0000")
|
||||
.setTitle("Results for: " + searchWord)
|
||||
.setDescription("Definition: " + data.definition)
|
||||
.addFields({
|
||||
name: 'Example',
|
||||
value: data.example
|
||||
})
|
||||
.setTimestamp()
|
||||
.setFooter({
|
||||
text: `Requested by ${interaction.user.tag}`,
|
||||
iconURL: `${interaction.user.displayAvatarURL()}`
|
||||
});
|
||||
interaction.editReply({
|
||||
embeds: [embed]
|
||||
});
|
||||
} else {
|
||||
return interaction.editReply("Sorry, no results were found!")
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
@ -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()
|
||||
});
|
||||
}
|
||||
|
@ -1,31 +1,26 @@
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const unirest = require('unirest');
|
||||
var unirest = require('unirest');
|
||||
|
||||
module.exports = {
|
||||
name: "bored",
|
||||
description: "Find an activity to do when you are bored.",
|
||||
|
||||
async run(client, interaction) {
|
||||
let response = await unirest
|
||||
run: async (client, interaction) => {
|
||||
|
||||
unirest
|
||||
.get('https://www.boredapi.com/api/activity')
|
||||
.headers({
|
||||
'Accept': 'application/json', 'Content-Type': 'application/json',
|
||||
});
|
||||
|
||||
let data = response.body;
|
||||
const embed = createBoredEmbed(data, interaction.user);
|
||||
interaction.followUp({ embeds: [embed] });
|
||||
})
|
||||
.then((response) => {
|
||||
let data = response.body
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor("#FF0000")
|
||||
.setTitle("Here is something to do!")
|
||||
.setDescription(data.activity)
|
||||
.setTimestamp()
|
||||
.setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL()}` });
|
||||
interaction.followUp({ embeds: [embed] });
|
||||
})
|
||||
},
|
||||
};
|
||||
|
||||
function createBoredEmbed(data, user) {
|
||||
return new EmbedBuilder()
|
||||
.setColor("#FF0000")
|
||||
.setTitle("Here is something to do!")
|
||||
.setDescription(data.activity)
|
||||
.setTimestamp()
|
||||
.setFooter({
|
||||
text: `Requested by ${user.tag}`,
|
||||
iconURL: user.displayAvatarURL()
|
||||
});
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
const { MessageEmbed, Attachment, TextChannel } = require('discord.js');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const { AttachmentBuilder } = require('discord.js');
|
||||
const { AwesomeQR } = require("awesome-qr");
|
||||
const fs = require("fs").promises;
|
||||
|
||||
let fileName;
|
||||
const fs = require("fs");
|
||||
|
||||
module.exports = {
|
||||
name: "qr",
|
||||
@ -15,36 +14,32 @@ module.exports = {
|
||||
}],
|
||||
|
||||
run: async (client, interaction) => {
|
||||
if (!fileName) {
|
||||
fileName = Math.floor(Math.random() * 99999).toString();
|
||||
}
|
||||
|
||||
const text = interaction.options._hoistedOptions[0].value;
|
||||
const background = Buffer.from(fs.readFileSync("Terminal-icon.png"));
|
||||
const buffer = await new AwesomeQR({
|
||||
text: text,
|
||||
size: 500,
|
||||
backgroundImage: background,
|
||||
}).draw();
|
||||
(async () => {
|
||||
let rand = Math.floor(Math.random() * 99999).toString();
|
||||
let text = interaction.options._hoistedOptions[0].value
|
||||
|
||||
await fs.writeFile(`./images/${fileName}.png`, buffer);
|
||||
const file = new Attachment(`./images/${fileName}.png`);
|
||||
const background = fs.readFileSync("Terminal-icon.png");
|
||||
|
||||
const embed = new MessageEmbed()
|
||||
const buffer = await new AwesomeQR({
|
||||
text: text,
|
||||
size: 500,
|
||||
backgroundImage: background,
|
||||
|
||||
}).draw();
|
||||
|
||||
fs.writeFileSync("./images/" + rand + ".png", buffer);
|
||||
const file = new AttachmentBuilder('./images/' + rand + ".png");
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor("#FF0000")
|
||||
.setTitle("Your Generated QR Code")
|
||||
.setTimestamp()
|
||||
.setImage(`attachment://images/${fileName}.png`)
|
||||
.setImage('attachment://images/' + rand + ".png")
|
||||
|
||||
.setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL()}` });
|
||||
try {
|
||||
const message = await interaction.channel.send({ embeds: [embed], files: [file] });
|
||||
setTimeout(async () => {
|
||||
// await message.delete();
|
||||
console.log(message)
|
||||
await fs.unlink(`./images/${fileName}.png`);
|
||||
}, 10000);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
interaction.editReply({ embeds: [embed], files: [file] });
|
||||
})();
|
||||
|
||||
},
|
||||
};
|
||||
|
Reference in New Issue
Block a user