aboutsummaryrefslogtreecommitdiff
path: root/commands/Moderation/interrogate.js
blob: a8fc250f9fe9ef3382f124b0611d9f77bc5df51e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/** **************************************
 *
 *   Interrogate: Plugin for PokeBot that allows the staff to investigate the fish :cod:
 *   Copyright (C) 2018 TheEdge, jtsshieh, Alee
 *
 *   Licensed under the Open Software License version 3.0
 *
 * *************************************/

exports.run = async (bot, msg) => {
  if (msg.guild.id != '417088992329334792') return msg.reply ('This is a PokeWorld exclusive command. Sorry!');

  if (!msg.member.hasPermission('BAN_MEMBERS')) return msg.reply('You don\'t have permission to interrogate others. Rip-off detectives...');
  if (!msg.guild.member(bot.user).hasPermission('MANAGE_ROLES')) return msg.reply('I cannot interrogate anyone.');

  const member = msg.mentions.members.first();
  if (!member) return await msg.reply('Who do I interrogate?');

  member.addRole(msg.guild.roles.find('name', 'Interrogation'));

  const { RichEmbed } = require('discord.js');
  try {
    const embed = new RichEmbed()
      .setColor(0x00ae86)
      .setAuthor(member.user.tag, member.user.avatarURL)
      .setTitle(`Interrogation: **${member.user.tag}**`)
      .setDescription(`*${member.user.tag}* was interrogated by *${msg.author.tag}*.`)
      .addField('Moderator', msg.author.tag)
      .setTimestamp()
      .setFooter(`${msg.author.tag} interrogated ${member.user.tag}.`, msg.author.avatarURL);
    const logChannel = await bot.plugins.settings.getStr('logs', msg.guild.id);
    msg.guild.channels.find('id', logChannel).send({ embed });
  }
  catch (err) {
    console.error(err.stack);
  }
};

exports.conf = {
  aliases: [],
  guildOnly: true,
};

exports.help = {
  name: 'interrogate',
  description: 'Interrogate a suspect/user.',
  usage: '@user',
};