From e06e8bcb81e6a1bb56946f1125be09ddbb4b3540 Mon Sep 17 00:00:00 2001 From: rhearmas <34490428+qu-ota@users.noreply.github.com> Date: Sat, 21 Dec 2019 11:05:14 -0500 Subject: [PATCH] urban! --- commands/Fun/urban.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 commands/Fun/urban.js diff --git a/commands/Fun/urban.js b/commands/Fun/urban.js new file mode 100644 index 0000000..721c307 --- /dev/null +++ b/commands/Fun/urban.js @@ -0,0 +1,40 @@ +const webdict = require('webdict'); + +exports.run = async (client, message, args, level) => { + message.delete(); + + if (!args[0]) return message.reply("you didn't provide a valid word to look up."); + + const parsed = client.parseArgs(args, ['e']); + const word = parsed.leftover.join(' '); + + webdict('urbandictionary', word).then(res => { + let result; + if (!res || !res.definition || !res.definition[0]) { + result = 'No results found.'; + } else { + result = res.definition[0]; + } + + if (parsed.options.e) { + message.channel.send(result); + return; + } + + message.channel.send(client.embed(`:book: ${word}`, result)); + }); +}; + +exports.conf = { + enabled: true, + guildOnly: false, + aliases: ['urban'], + permLevel: "User" +}; + +exports.help = { + name: "urbandictionary", + category: "Utility", + description: "Looks up a word in the urban dictionary.", + usage: "urbandictionary " +};