From 749f80ac9c218c2ba1c0f97cacffef0c43338a34 Mon Sep 17 00:00:00 2001 From: Emily J Date: Sat, 10 Oct 2020 16:07:15 +1100 Subject: [PATCH] access all 3 db's instead of just guild --- bot/commands/Test/retrieve.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bot/commands/Test/retrieve.js b/bot/commands/Test/retrieve.js index 10d12a5..617aaea 100644 --- a/bot/commands/Test/retrieve.js +++ b/bot/commands/Test/retrieve.js @@ -10,14 +10,14 @@ class Retrieve extends Command { } async run (message, args, data) { // eslint-disable-line no-unused-vars - if (!args[0]) return message.channel.send("You didn't specify what key to retrieve!") - - try { - const res = await this.client.db.getGuildKey(message.guild.id, args[0]) - message.channel.send(res) - } catch (err) { - return message.channel.send(err) + if (!args[0]) return message.channel.send("You didn't specify what database to access!"); + if (args[0].toLowerCase() !== 'guild' && args[0].toLowerCase() !== 'member' && args[0].toLowerCase() !== 'user') { + return message.channel.send('Invalid database. Valid databases: `guild`, `member`, `user`'); } + + let res = data[args[0]][args[1]]; + if (!res) return message.channel.send('Invalid key. Check for typing errors and try again.'); + message.channel.send('```' + res + '```') } }