Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const urban = require('relevant-urban'),
  2.   Discord = require('discord.js');
  3.  
  4. module.exports.run = async (client, message, args, tools) => {
  5.  
  6.  
  7.   if (!args[0]) return message.channel.send(`**Please specify some text!`);
  8.  
  9.  
  10.   let res = await urban(args.join(' ')).catch(e => {
  11.     return message.channel.send('Sorry, that word was not found!');
  12.    
  13.   });
  14.      
  15.  
  16.   const embed = new Discord.RichEmbed()
  17.     .setColor('RANDOM')
  18.     .setTitle(res.word)
  19.     .setUrl(res.urbanURL)
  20.     .setDescription(`Definition: \n${res.definition}\n\nExample:\n${res.example}`)
  21.     .setField('Author', res.author, true)
  22.     .addField('Rating',`Upvotes: ${res.thumbsUp} | Downvotes: ${res.thumbsDown}`)
  23.  
  24.   if (res.tags.length > 0 && res.tags.join(' ').length < 1024) {
  25.  
  26.     embed.addField('Tags', res.tags.join(', '), true)
  27.  
  28.      message.channel.send(embed);
  29.  
  30.   }
  31.  
  32. module.exports.help = {
  33.   name: "Urban Dictionary",
  34.   usage: "ud <word>",
  35.   description: "Command used find definitions of words in the urban dictionary."
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement