chomens-bot-js/commands/urban.js

20 lines
829 B
JavaScript
Raw Normal View History

2022-11-27 02:35:28 -05:00
const urban = require('urban-dictionary')
2022-08-14 05:51:45 -04:00
module.exports = {
name: 'urban',
alias: [],
description: 'Working Urban Dictionary',
usage: '<word>',
trusted: 0,
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
2022-08-14 05:51:45 -04:00
urban.autocompleteExtra(args[0], (error, results) => {
if (error) {
2022-11-27 02:35:28 -05:00
bot.tellraw(selector, [{ text: '[', color: 'dark_red' }, { text: 'Urban', color: 'red' }, { text: '] ', color: 'dark_red' }, { text: error.message, color: 'red' }])
return
2022-08-14 05:51:45 -04:00
}
2022-11-27 02:35:28 -05:00
results.forEach(({ preview, term }) => {
bot.tellraw(selector, [{ text: '[', color: 'dark_red' }, { text: 'Urban', color: 'red' }, { text: '] ', color: 'dark_red' }, { text: term, color: 'white' }, { text: ' - ', color: 'white' }, { text: preview, color: 'white' }])
})
})
}
}