Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
102
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. if (!args[0]) return message.channel.send(`**Please specify some text!`);
  7.  
  8.  let res = await urban(args.join(' ')).catch(e => {
  9.     return message.channel.send('Sorry, that word was not found!');
  10.   let embed = new Discord.RichEmbed()
  11.     .setColor('RANDOM')
  12.     .setTitle(res.word)
  13.     .setUrl(res.urbanURL)
  14.     .setDescription(`Definition: \n${res.definition}\n\nExample:\n${res.example}`)
  15.     .setField('Author', res.author, true)
  16.     .addField('Rating',`Upvotes: ${res.thumbsUp} | Downvotes: ${res.thumbsDown}`);
  17.    
  18.      if (res.tags.length > 0 && res.tags.join(' ').length < 1024) {
  19.  
  20.     embed.addField('Tags', res.tags.join(', '), true)
  21.  
  22.      message.channel.send(embed);
  23.  
  24.   }
  25. }  
  26.   );
  27. }
  28.                                              
  29. module.exports.help = {
  30.   name: "Urban Dictionary",
  31.   usage: "ud <word>",
  32.   description: "Command used find definitions of words in the urban dictionary."
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement