access all 3 db's instead of just guild
This commit is contained in:
		
							parent
							
								
									023d630606
								
							
						
					
					
						commit
						749f80ac9c
					
				
					 1 changed files with 7 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -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 + '```')
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue