Haha-Yes/commands/utility/seebannedword.js

41 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;
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'],
2020-03-19 23:24:31 +01:00
channel: 'guild',
2019-08-21 21:34:29 +02:00
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.');
2019-11-22 12:30:20 +01:00
const Embed = this.client.util.embed()
2020-03-22 21:54:19 +01:00
.setColor(message.member ? message.member.displayHexColor : 'NAVY')
2019-08-21 21:34:29 +02:00
.setTitle('List of banned words')
.setDescription(list);
return message.channel.send(Embed);
}
}
module.exports = seebannedwordCommand;