How to use the urban.js function in urban

To help you get started, we’ve selected a few urban examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github funo-bot / Funo / src / commands / UrbanCommand.js View on Github external
if (!message.channel.nsfw) {
    return message.channel.send(new Discord.RichEmbed()
      .setColor("RED")
      .setDescription("This command can only be used in NSFW channels.")
    );
  }

  if (!args[0]) {
    return message.channel.send(new Discord.RichEmbed()
      .setDescription("You must provide a search query")
      .setColor("RED")
    );
  }

  urban(args.slice(0).join(" ")).then((body) => {
    message.channel.send(new Discord.RichEmbed()
      .setTitle(`${body.word} by ${body.author}`)
      .setDescription(body.definition)
      .addField("Example(s)", body.example)
      .addBlankField()
      .addField("Reacts", `:thumbsup: ${body.thumbsUp} | :thumbsdown: ${body.thumbsDown}`, true)
      .addField("URL", body.URL, true)
      .setColor("#1D2439")
    );
  }).catch((rejection) => message.channel.send(new Discord.RichEmbed()
    .setColor("#1D2439")
    .setDescription("Could not find any definition matching " + args.slice(0).join(" "))
  ));
};

urban

Simple API and command line for Urban Dictionary

MIT
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis

Popular urban functions