actually you need a try-catch

(else it throws uncaught exception)
This commit is contained in:
ChomeNS 2023-01-01 16:28:52 +07:00
parent e049a9e0ea
commit 59a6d573b8

View file

@ -6,10 +6,14 @@ module.exports = {
usage: '<word>', usage: '<word>',
trusted: 0, trusted: 0,
async execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) { async execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
const definitions = await urban.define(args.join(' ')) try {
const definitions = await urban.define(args.join(' '))
for (const definition of definitions) { 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' }]) 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' })
} }
} }
} }