2021-04-05 12:21:27 +00:00
|
|
|
import {Command, NamedCommand} from "../../core";
|
2021-03-31 01:40:29 +00:00
|
|
|
import {MessageEmbed} from "discord.js";
|
|
|
|
// Anycasting Alert
|
|
|
|
const urban = require("relevant-urban");
|
|
|
|
|
2021-04-05 12:21:27 +00:00
|
|
|
export default new NamedCommand({
|
2021-03-31 01:40:29 +00:00
|
|
|
description: "Gives you a definition of the inputted word.",
|
2021-04-05 12:21:27 +00:00
|
|
|
async run({message, channel, guild, author, member, client, args}) {
|
|
|
|
if (!args[0]) {
|
|
|
|
channel.send("Please input a word.");
|
2021-03-31 01:40:29 +00:00
|
|
|
}
|
2021-04-05 12:21:27 +00:00
|
|
|
const res = await urban(args.join(" ")).catch((e: Error) => {
|
|
|
|
return channel.send("Sorry, that word was not found.");
|
2021-03-31 01:40:29 +00:00
|
|
|
});
|
|
|
|
const embed = new MessageEmbed()
|
|
|
|
.setColor(0x1d2439)
|
|
|
|
.setTitle(res.word)
|
|
|
|
.setURL(res.urbanURL)
|
|
|
|
.setDescription(`**Definition:**\n*${res.definition}*\n\n**Example:**\n*${res.example}*`)
|
|
|
|
.addField("Author", res.author, true)
|
|
|
|
.addField("Rating", `**\`Upvotes: ${res.thumbsUp} | Downvotes: ${res.thumbsDown}\`**`);
|
|
|
|
if (res.tags.length > 0 && res.tags.join(" ").length < 1024) {
|
|
|
|
embed.addField("Tags", res.tags.join(", "), true);
|
|
|
|
}
|
2021-04-05 12:21:27 +00:00
|
|
|
channel.send(embed);
|
2021-03-31 01:40:29 +00:00
|
|
|
}
|
|
|
|
});
|