mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-23 15:47:57 -05:00
Merge pull request #1 from ChipmunkMC/improve-urban-command
Rewrite `urban` command
This commit is contained in:
commit
e049a9e0ea
1 changed files with 6 additions and 10 deletions
|
@ -5,15 +5,11 @@ module.exports = {
|
||||||
description: 'Working Urban Dictionary',
|
description: 'Working Urban Dictionary',
|
||||||
usage: '<word>',
|
usage: '<word>',
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
async execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
urban.autocompleteExtra(args[0], (error, results) => {
|
const definitions = await urban.define(args.join(' '))
|
||||||
if (error) {
|
|
||||||
bot.tellraw(selector, [{ text: '[', color: 'dark_red' }, { text: 'Urban', color: 'red' }, { text: '] ', color: 'dark_red' }, { text: error.message, color: 'red' }])
|
for (const definition of definitions) {
|
||||||
return
|
bot.tellraw(selector, [{ text: '[', color: 'dark_red' }, { text: 'Urban', color: 'red' }, { text: '] ', color: 'dark_red' }, { text: definition.word, color: 'white' }, { text: ' - ', color: 'white' }, { text: definition.definition, color: 'white' }])
|
||||||
}
|
}
|
||||||
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' }])
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue