chomens-bot-js/commands/urban.js
ChomeNS 6895a37104 bot.tellraw()
i totally did not used the search icon thing in vscode
2022-11-07 18:30:37 +07:00

20 lines
831 B
JavaScript

/* eslint-disable max-len */
const urban = require('urban-dictionary');
module.exports = {
name: 'urban',
alias: [],
description: 'Working Urban Dictionary',
usage: '<word>',
trusted: 0,
execute: function(bot, username, usernameraw, sender, prefix, args) {
urban.autocompleteExtra(args[0], (error, results) => {
if (error) {
bot.tellraw('@a', ['', {text: '[', color: 'dark_red'}, {text: 'Urban', color: 'red'}, {text: '] ', color: 'dark_red'}, {text: error.message, color: 'red'}]);
return;
}
results.forEach(({preview, term}) => {
bot.tellraw('@a', ['', {text: '[', color: 'dark_red'}, {text: 'Urban', color: 'red'}, {text: '] ', color: 'dark_red'}, {text: term, color: 'white'}, {text: ' - ', color: 'white'}, {text: preview, color: 'white'}]);
});
});
},
};