From fd14f3b55fb3559e7eba8e75347b55a54c165605 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Wed, 21 Aug 2019 21:34:29 +0200 Subject: [PATCH] show banned word --- commands/utility/seebannedword.js | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 commands/utility/seebannedword.js diff --git a/commands/utility/seebannedword.js b/commands/utility/seebannedword.js new file mode 100644 index 00000000..2c1a88dd --- /dev/null +++ b/commands/utility/seebannedword.js @@ -0,0 +1,41 @@ +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', + channelRestriction: 'guild', + description: { + content: 'Show the list of tag for this server. --all to get a txt file with info about every tag on the server', + usage: '[name of tag]', + 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() + .setColor('#ff9900') + .setTitle('List of banned words') + .setDescription(list); + + return message.channel.send(Embed); + } +} +module.exports = seebannedwordCommand; \ No newline at end of file