Haha-Yes/commands/utility/seebannedword.js

42 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-08-21 21:34:29 +02:00
const { Command } = require('discord-akairo');
const BannedWords = require('../../models').bannedWords;
const { MessageEmbed } = require('discord.js');
class seebannedwordCommand extends Command {
constructor() {
super('seebannedword', {
aliases: ['seebannedword', 'seeban', 'seebanword'],
category: 'utility',
2019-11-09 12:04:01 +01:00
clientPermissions: ['SEND_MESSAGES', 'EMBED_LINKS'],
2019-08-21 21:34:29 +02:00
channelRestriction: 'guild',
description: {
2019-08-21 21:36:11 +02:00
content: 'Show the list of banned word',
usage: '',
2019-08-21 21:34:29 +02:00
examples: ['']
}
});
}
async exec(message) {
const bannedWords = await BannedWords.findAll({where: {serverID: message.guild.id}});
let list;
for (let i = 0; i < bannedWords.length; i++) {
if (i == 0) {
list = bannedWords[i].get('word');
} else {
list = list + ' | ' + bannedWords[i].get('word');
}
}
if (list == undefined) return message.channel.send('No word are banned yet.');
const Embed = new MessageEmbed()
2019-11-02 00:54:40 +01:00
.setColor(message.member.displayHexColor)
2019-08-21 21:34:29 +02:00
.setTitle('List of banned words')
.setDescription(list);
return message.channel.send(Embed);
}
}
module.exports = seebannedwordCommand;