From 2b70fae94d5a762c6535fff6b42d4fa1cbe6a64a Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Wed, 3 Apr 2024 18:21:58 -0400 Subject: [PATCH] Fix --- commands/search/periodic-table.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/commands/search/periodic-table.js b/commands/search/periodic-table.js index 04001e56..af94b52b 100644 --- a/commands/search/periodic-table.js +++ b/commands/search/periodic-table.js @@ -47,14 +47,16 @@ module.exports = class PeriodicTableCommand extends Command { { key: 'element', type: 'string', - validate: element => { + validate: async element => { + if (!this.table) await this.fetchTable(); const num = Number.parseInt(element, 10); if (!Number.isNaN(num) && num >= 0 && num <= this.table.length - 1) return true; const search = element.toString().toLowerCase(); if (this.table.find(e => e.name.toLowerCase() === search || e.symbol.toLowerCase() === search)) return true; return 'Invalid element, please enter a valid element symbol, name, or atomic number.'; }, - parse: element => { + parse: async element => { + if (!this.table) await this.fetchTable(); const num = Number.parseInt(element, 10); if (!Number.isNaN(num)) return this.table[num]; const search = element.toLowerCase();