From 59a6d573b89006e4ee16ebdaafeb63ce8cc55246 Mon Sep 17 00:00:00 2001 From: ChomeNS Date: Sun, 1 Jan 2023 16:28:52 +0700 Subject: [PATCH] actually you need a try-catch (else it throws uncaught exception) --- commands/urban.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/commands/urban.js b/commands/urban.js index 813cb4e..c3b801a 100644 --- a/commands/urban.js +++ b/commands/urban.js @@ -6,10 +6,14 @@ module.exports = { usage: '', trusted: 0, 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) { - 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' }]) + 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' }) } } }