aboutsummaryrefslogtreecommitdiff
path: root/commands/Moderation/lswarns.js
blob: de0be314cd3a8b726f852663a3adffa3db4a7b9a (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
/** **************************************
 *
 *   List Warns: Plugin for Galaxy 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 await 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.',
};