access all 3 db's instead of just guild

This commit is contained in:
Emily 2020-10-10 16:07:15 +11:00
parent 023d630606
commit 749f80ac9c

View file

@ -10,14 +10,14 @@ class Retrieve extends Command {
} }
async run (message, args, data) { // eslint-disable-line no-unused-vars 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!") 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') {
try { return message.channel.send('Invalid database. Valid databases: `guild`, `member`, `user`');
const res = await this.client.db.getGuildKey(message.guild.id, args[0])
message.channel.send(res)
} catch (err) {
return message.channel.send(err)
} }
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 + '```')
} }
} }