const { Command } = require('discord-akairo');
const { stripIndents } = require('../../util/Util.js');

const permCheck = {
  client: (member) => member.id === member.client.ownerID,
  guild: (member) => member.permissions.has('MANAGE_GUILD'),
  channel: (member) => member.permissions.has('MANAGE_CHANNLES')
};

function exec(msg, args) {
  const { member, scope } = args;
  if (!member) return msg.util.error('you need to specfy a member to ignore.');
  if (!permCheck[scope](msg.member)) {
    return msg.util.error('you do not have permission to ignore members in that scope.');
  }

  const [table, id] = scope === 'client'
    ? [`${scope}s`, msg[scope]] : [scope, 'haku'];
  const db = this.client.db[table];
  const { blacklist } = db.get(id);

  if (blacklist.includes(member.id)) return msg.util.error(`**${member.displayName}** is already ignored in this ${scope}.`);

  blacklist.push(member.id);
  db.set(id, { blacklist });
  return msg.util.success(`**${member.displayName}** has been ignored in this ${scope}.`);
}

module.exports = new Command('ignore', exec, {
  aliases: ['ignore', 'blacklist'],
  channelRestriction: 'guild',
  args: [
    {
      id: 'member',
      type: 'member'
    },
    {
      id: 'scope',
      type: ['client', 'guild', 'channel'],
      default: 'guild'
    }
  ],
  description: stripIndents`
    Prevent a user from using commands.
    **Optional arguments:**
    \`scope\` - the scope in which to ignore the user (defaults to guild).

    **Usage:**
    \`ignore TeeSeal\` => ignores the user in the current guild.
    \`ignore TeeSeal channel\` => ignores the user in the current channel.
  `
});

@@ -60,16 +60,27 @@
 pIndents
+, getDBData
  %7D = req
@@ -618,76 +618,29 @@
 %5D = 
-scope === 'client'%0A    ? %5B%60$%7Bscope%7Ds%60, msg%5Bscope%5D%5D : %5Bscope, 'haku'%5D
+getDBData(msg, scope)
 ;%0A  

Fix ignore