aboutsummaryrefslogtreecommitdiff
path: root/commands/Moderation/lswarns.js
blob: 7b39d1214de2c3465a2fa70fcf022bbd26473eb3 (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
/** **************************************
 *
 *   List Warns: Plugin for PokeBot that performs moderation actions.
 *   Copyright (C) 2018 TheEdge, jtsshieh, Alee
 *
 *   Licensed under the Open Software License version 3.0
 *
 * *************************************/

exports.run = async (bot, msg) => {
  const db = require('quick.db');
  const {RichEmbed} = require('discord.js');

  const warns = await db.fetch(`warns_${msg.guild.id}_${msg.author.id}`);
  if (!warns) {
    return msg.reply('You don\'t have any warnings in this server.');
  }
  const embed = new RichEmbed()
    .setTitle('Warns');
  for (let i = 0; i < warns.count; i++) {
    embed.addField(`Warning #${ i }${1}`, warns.reasons[i]);
  }
  msg.channel.send({embed});
};

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

exports.help = {
  name: 'lswarns',
  description: 'Shows all the warnings a user has.'
};