mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
actually you need a try-catch
(else it throws uncaught exception)
This commit is contained in:
parent
e049a9e0ea
commit
59a6d573b8
1 changed files with 7 additions and 3 deletions
|
@ -6,10 +6,14 @@ module.exports = {
|
|||
usage: '<word>',
|
||||
trusted: 0,
|
||||
async execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
try {
|
||||
const definitions = await urban.define(args.join(' '))
|
||||
|
||||
for (const definition of definitions) {
|
||||
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' }])
|
||||
}
|
||||
} catch (e) {
|
||||
bot.tellraw(selector, { text: e.toString(), color: 'red' })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue