How to use urban - 6 common examples

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 c3duan / Swag-Bot / commands / hangman.js View on Github external
async execute(client, kayn, REGIONS, config, message, args, con, guilds) {
        if (this.playing.has(message.channel.id)) return message.reply('Only one game may be occurring per channel.');
		this.playing.add(message.channel.id);
		try {
            urban.random().first(async json => {
                const word = json.word.toLowerCase().replace(/ /g, '-');
                let points = 0;
                let displayText = null;
                let guessed = false;
                const confirmation = [];
                const incorrect = [];
                const display = new Array(word.length).fill('_');
                while (word.length !== confirmation.length && points < 6) {
                    await message.channel.send(stripIndents`
                        ${displayText === null ? 'Here we go!' : displayText ? 'Good job!' : 'Nope!'}
                        \`${display.join(' ')}\`. Which letter do you choose?
                        Incorrect Tries: ${incorrect.join(', ') || 'None'}
                        \`\`\`
                        ___________
                        |     |
                        |     ${points > 0 ? 'O' : ''}
github c3duan / Swag-Bot / commands / random-urban.js View on Github external
execute(client, kayn, REGIONS, config, message, args, con, guilds) {
        urban.random().first(json => {
            const def = new Discord.RichEmbed()
                .setTitle(json.word)
                .setDescription(json.definition)
                .addField('Upvotes', json.thumbs_up, true)
                .addField('Downvotes', json.thumbs_down, true)
                .setTimestamp(new Date())
                .setFooter(`Written by ${json.author}`);

            message.channel.send(def);
        });
    },
};
github Sync-Codes / Ajax / commands / randomdefine.js View on Github external
module.exports.run = async (bot, message, args) => {


  urban.random().first(json => {
    let uEmbed = new Discord.RichEmbed()
    .setTitle(json.word)
    .setDescription(json.definition || "None")
    .addField("Upvotes :arrow_up_small: ", json.thumbs_up, true)
    .addField("Downvotes :arrow_down_small: ", json.thumbs_down, true)
    .setAuthor(`Author: ${json.author}`);
    message.channel.send(uEmbed);
  });
}
github Gravebot / Gravebot / src / commands / useful / urban.js View on Github external
return new Promise(resolve => {
    urbanQuery(suffix).first((json) => {
      if (json) {
        resolve(`${json.word}: ${json.definition}
  :arrow_up: ${json.thumbs_up}   :arrow_down: ${json.thumbs_down}

  Example: ${json.example}`);
      } else {
        resolve(`${T('urban_error', lang)}: ${suffix}`);
      }
    });
  });
}
github Gravebot / Gravebot / lib / misc.js View on Github external
function urban(bot, msg, suffix) {
  if (!suffix) {
    bot.sendMessage(msg.channel, 'Usage: **`!urban`** `search terms`');
    return;
  }
  urbanQuery(suffix).first((json) => {
    if (json) {
      let definition = `${json.word}: ${json.definition}
:arrow_up: ${json.thumbs_up}   :arrow_down: ${json.thumbs_down}

Example: ${json.example}`;
      bot.sendMessage(msg.channel, definition);
    } else {
      bot.sendMessage(msg.channel, `I couldn't find a definition for: ${suffix}`);
    }
  });
}
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